First of all, I'm really happy about what I think is the more deterministic behavior of new memorymenegment we see in orc and arc. I notice, however, that I still don't understand a certain behavior of Orc memory management and hope to become a little wiser by asking this questions.
From what I understand, the cyclic collector in orc is thread-local. This means that among other things potential cyclic objects first execute "registerCycle" when they are created and then "unregisterCycle" when they are destroyed, and that checks are also carried out in the runtime of the thread to clean up cyclic objects.
Now I thought that if an object is marked with the async pragma (https://nim-lang.org/docs/manual.html#pragmas-acyclic-pragma) then the compiler will treat it like an acyclic object and doesn't even get into the thread-local memory management. But my tests show that I'm wrong somewhere or don't understand something:
This error comes when I create and destroy an object marked as acyclic in different threads
.../system/orc.nim(486) nimDecRefIsLastCyclicDyn
.../system/orc.nim(469) rememberCycle
.../system/orc.nim(148) unregisterCycle
SIGSEGV: Illegal storage access. (Attempt to read from nil?)
Segmentation fault
Can someone please explain the acyclic pragma to me? Or is there a reason why an Object marked as acyclic is still registered and unregistered in the threadlocal runtime?
Thanks