blob: 770d413f5c24cb057c62a34d5619b85c751a47b0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
discard """
matrix: "--gc:refc; --gc:arc; --gc:orc"
targets: "c"
"""
when compileOption("gc", "refc") or not defined(openbsd):
# xxx openbsd gave: stdlib_coro.nim.c:406:22: error: array type 'jmp_buf' (aka 'long [11]') is not assignable (*dest).execContext = src.execContext;
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")
|