GC tests now finally part of testsuite

This commit is contained in:
Araq 2011-11-10 02:13:02 +01:00
commit 2bd14f4ba8
11 changed files with 79 additions and 672 deletions

27
tests/gc/gcleak3.nim Executable file
View file

@ -0,0 +1,27 @@
discard """
outputsub: "no leak: "
"""
type
TSomething = object
s: string
s1: string
var s: seq[TSomething] = @[]
for i in 0..1024:
var obj: TSomething
obj.s = "blah"
obj.s1 = "asd"
s.add(obj)
proc limit*[t](a: var seq[t]) =
var loop = s.len() - 512
for i in 0..loop:
#echo i
#GC_fullCollect()
if getOccupiedMem() > 3000_000: quit("still a leak!")
s.delete(i)
s.limit()
echo "no leak: ", getOccupiedMem()