growobjcrash.nim 576 B

1234567891011121314151617181920212223242526272829
  1. discard """
  2. retries: 2
  3. """
  4. import std/[cgi, strtabs]
  5. proc handleRequest(query: string): StringTableRef =
  6. iterator foo(): StringTableRef {.closure.} =
  7. var params = {:}.newStringTable()
  8. for key, val in cgi.decodeData(query):
  9. params[key] = val
  10. yield params
  11. let x = foo
  12. result = x()
  13. const Limit = 5*1024*1024
  14. proc main =
  15. var counter = 0
  16. for i in 0 .. 10_000:
  17. for k, v in handleRequest("nick=Elina2&type=activate"):
  18. inc counter
  19. if counter mod 100 == 0:
  20. if getOccupiedMem() > Limit:
  21. quit "but now a leak"
  22. main()