fixes #2070
This commit is contained in:
parent
c2da0e9b3d
commit
0284e8d11c
3 changed files with 32 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
=====================================================
|
=====================================================
|
||||||
Nim -- a Compiler for Nim. http://nim-lang.org/
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
||||||
29
tests/gc/growobjcrash.nim
Normal file
29
tests/gc/growobjcrash.nim
Normal file
|
|
@ -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"
|
||||||
|
|
@ -121,6 +121,7 @@ proc gcTests(r: var TResults, cat: Category, options: string) =
|
||||||
testSpec r, makeTest("tests/gc" / filename, options &
|
testSpec r, makeTest("tests/gc" / filename, options &
|
||||||
" -d:release --gc:markAndSweep", cat, actionRun)
|
" -d:release --gc:markAndSweep", cat, actionRun)
|
||||||
|
|
||||||
|
test "growobjcrash"
|
||||||
test "gcbench"
|
test "gcbench"
|
||||||
test "gcleak"
|
test "gcleak"
|
||||||
test "gcleak2"
|
test "gcleak2"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue