> How is this possible and what does it mean? It's weird and wrong behavior. > Such unpredictable things should not happen, it fences off Nim from serious > developers. > > Local variable "x" went out of scope and definitely is garbage. Before > "GC_FullCollect()" pointer to "x" should be out of the stack.
I don't feel like explaining to you here how a semi-precise GC works or how many other different GC implementations take the same approach. Some "serious" developers know that finalizers are not destructors. > How to be sure that finalizers will be called after calling "GC_FullCollect"? By writing non-toy Nim programs and studying their memory behaviour at runtime.
