mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 18:02:05 +00:00
24 lines
415 B
Nim
24 lines
415 B
Nim
discard """
|
|
outputsub: "no leak: "
|
|
"""
|
|
|
|
when defined(GC_setMaxPause):
|
|
GC_setMaxPause 2_000
|
|
|
|
type
|
|
TTestObj = object of TObject
|
|
x: string
|
|
|
|
proc MakeObj(): TTestObj =
|
|
result.x = "Hello"
|
|
|
|
for i in 1 .. 1_000_000:
|
|
when defined(gcMarkAndSweep):
|
|
GC_fullcollect()
|
|
var obj = MakeObj()
|
|
if getOccupiedMem() > 300_000: quit("still a leak!")
|
|
# echo GC_getstatistics()
|
|
|
|
echo "no leak: ", getOccupiedMem()
|
|
|