summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2015-02-10 20:18:23 +0100
committerAraq <rumpf_a@web.de>2015-02-10 20:19:48 +0100
commit0284e8d11c5f93f1ff6c44f83ca8e4ba73365c98 (patch)
treec5e0ff7b5508354f6367620e87caf9733ba1acf5
parentc2da0e9b3db54597fc35b65a23d67aa3c5714e82 (diff)
downloadNim-0284e8d11c5f93f1ff6c44f83ca8e4ba73365c98.tar.gz
fixes #2070
-rw-r--r--copying.txt2
-rw-r--r--tests/gc/growobjcrash.nim29
-rw-r--r--tests/testament/categories.nim3
3 files changed, 32 insertions, 2 deletions
diff --git a/copying.txt b/copying.txt
index 908625e18..d89bace0b 100644
--- a/copying.txt
+++ b/copying.txt
@@ -1,7 +1,7 @@
 =====================================================
 Nim -- a Compiler for Nim. http://nim-lang.org/
 
-Copyright (C) 2006-2014 Andreas Rumpf. All rights reserved.
+Copyright (C) 2006-2015 Andreas Rumpf. All rights reserved.
  
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/tests/gc/growobjcrash.nim b/tests/gc/growobjcrash.nim
new file mode 100644
index 000000000..00620fed3
--- /dev/null
+++ b/tests/gc/growobjcrash.nim
@@ -0,0 +1,29 @@
+discard """
+  output: "works"
+"""
+
+import cgi, strtabs
+
+proc handleRequest(query: string): StringTableRef =
+  iterator foo(): StringTableRef {.closure.} =
+    var params = {:}.newStringTable()
+    for key, val in cgi.decodeData(query):
+      params[key] = val
+    yield params
+
+  let x = foo
+  result = x()
+
+const Limit = when compileOption("gc", "markAndSweep"): 5*1024*1024 else: 500_000
+
+proc main =
+  var counter = 0
+  for i in 0 .. 100_000:
+    for k, v in handleRequest("nick=Elina2&type=activate"):
+      inc counter
+      if counter mod 100 == 0:
+        if getOccupiedMem() > Limit:
+          quit "but now a leak"
+
+main()
+echo "works"
diff --git a/tests/testament/categories.nim b/tests/testament/categories.nim
index 54e962693..ed4d27cab 100644
--- a/tests/testament/categories.nim
+++ b/tests/testament/categories.nim
@@ -120,7 +120,8 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
                   " --gc:markAndSweep", cat, actionRun)
     testSpec r, makeTest("tests/gc" / filename, options &
                   " -d:release --gc:markAndSweep", cat, actionRun)
-  
+
+  test "growobjcrash"
   test "gcbench"
   test "gcleak"
   test "gcleak2"