summary refs log tree commit diff stats
path: root/tests/coroutines/tgc.nim
blob: 66a12ab9d413911b84e10687451e0876d868e2b1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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")