1234567891011121314151617181920212223 |
- discard """
- matrix: "--gc:refc; --gc:arc; --gc:orc"
- targets: "c"
- """
- when compileOption("gc", "refc") or not defined(openbsd):
- 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")
|