Maybe I should add this as a bug directly at Github, but I think I have found a bug in ARC/ORC, but please check that I'm not doing something fishy.
Consider this program:
const
num_of_objects = 1_000_000
type
node = object
name: string
child: nodeRef
nodeRef = ref node
proc allocAndDump() =
var s = newSeqOfCap[nodeRef](num_of_objects)
for i in 1..num_of_objects:
s &= nodeRef(name: "foo", child: nil)
var prev: nodeRef = nil
for o in s.mitems:
o.child = prev
prev = o
allocAndDump()
For small values of num_of_objects it works like it should, but for larger values like 1_000_000 it crashes in lib/system/orc.nim:503 (unregisterCycle(s)), when compiled with --mm:orc and in lib/system/arc.nim:213 (proc nimDecRefIsLast) when compiled with --mm:arc. With refc it works without problems.
Am I doing something wrong?