summary refs log blame commit diff stats
path: root/tests/coroutines/tgc.nim
blob: 46f4f8e838f0c74a0cf49a703c321d74cb465290 (plain) (tree)
1
2
3
4



             














                                                                                                    
discard """
  target: "c"
"""

import coro

var maxOccupiedMemory = 0

proc testGC() =
  var numbers = newSeq[int](100)
  maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
  suspend(0)

start(testGC)
start(testGC)
run()

GC_fullCollect()
doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")