Nim/tests/gc/gcleak2.nim
2011-11-10 02:13:02 +01:00

23 lines
372 B
Nim
Executable file

discard """
outputsub: "no leak: "
"""
type
TTestObj = object of TObject
x: string
s: seq[int]
proc MakeObj(): TTestObj =
result.x = "Hello"
result.s = @[1,2,3]
proc inProc() =
for i in 1 .. 100_000_000:
var obj: TTestObj
obj = MakeObj()
if getOccupiedMem() > 300_000: quit("still a leak!")
inProc()
echo "no leak: ", getOccupiedMem()