summary refs log blame commit diff stats
path: root/tests/gc/gcleak.nim
blob: c40c6b3b54bd9d3949f81afdf4c421535f01cd7f (plain) (tree)
1
2
3
4
5
6
7



                        


                             






                              
                          
                     
                                                      
                          
 

                                  
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 .. 100_000_000:
  var obj = MakeObj()
  if getOccupiedMem() > 300_000: quit("still a leak!")
#  echo GC_getstatistics()

echo "no leak: ", getOccupiedMem()