1discard """
2  matrix: "--gc:refc; --gc:arc; --gc:orc"
3  target: "c"
4"""
5
6when compileOption("gc", "refc") or not defined(openbsd):
7  # xxx openbsd gave: stdlib_coro.nim.c:406:22: error: array type 'jmp_buf' (aka 'long [11]') is not assignable (*dest).execContext = src.execContext;
8  import coro
9
10  var maxOccupiedMemory = 0
11
12  proc testGC() =
13    var numbers = newSeq[int](100)
14    maxOccupiedMemory = max(maxOccupiedMemory, getOccupiedMem())
15    suspend(0)
16
17  start(testGC)
18  start(testGC)
19  run()
20
21  GC_fullCollect()
22  doAssert(getOccupiedMem() < maxOccupiedMemory, "GC did not free any memory allocated in coroutines")
23