mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-01 04:59:05 +00:00
27 lines
497 B
Nim
27 lines
497 B
Nim
discard """
|
|
cmd: "nim c --mm:yrc -d:useMalloc --threads:on $file"
|
|
output: "done"
|
|
valgrind: "leaks"
|
|
disabled: "windows"
|
|
disabled: "freebsd"
|
|
disabled: "openbsd"
|
|
"""
|
|
|
|
# Smallest possible cycle: a three-node ring that is dead the instant `mk`
|
|
# returns. GC_fullCollect must reclaim it without touching freed memory.
|
|
|
|
type Node = ref object
|
|
next: Node
|
|
|
|
proc mk =
|
|
let a = Node()
|
|
let b = Node()
|
|
let c = Node()
|
|
a.next = b
|
|
b.next = c
|
|
c.next = a
|
|
|
|
mk()
|
|
GC_fullCollect()
|
|
echo "done"
|