mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-04 12:07:51 +00:00
* done * Apply suggestions from code review * fixup Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
23 lines
623 B
Nim
23 lines
623 B
Nim
discard """
|
|
matrix: "--gc:refc; --gc:arc; --gc:orc"
|
|
target: "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")
|