growobjcrash.nim 546 B

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