* first implementation of the =trace and =dispose hooks for the cycle collector * a cycle collector for ARC: progress * manual: the .acyclic pragma is a thing once again * gcbench: adaptations for --gc:arc * enable valgrind tests for the strutils tests * testament: better valgrind support * ARC refactoring: growable jumpstacks * ARC cycle detector: non-recursive algorithm * moved and renamed core/ files back to system/ * refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
26 lines
445 B
Nim
26 lines
445 B
Nim
discard """
|
|
output: '''leak: false'''
|
|
cmd: '''nim c --gc:orc $file'''
|
|
"""
|
|
|
|
type
|
|
T = ref object
|
|
s: seq[T]
|
|
data: string
|
|
|
|
proc create(): T = T(s: @[], data: "abc")
|
|
|
|
proc addX(x: T; data: string) =
|
|
x.data = data
|
|
|
|
proc addX(x: T; child: T) =
|
|
x.s.add child
|
|
|
|
proc main(rootName: string) =
|
|
var root = create()
|
|
root.data = rootName
|
|
root.addX root
|
|
|
|
let mem = getOccupiedMem()
|
|
main("yeah")
|
|
echo "leak: ", getOccupiedMem() - mem > 0
|