current GC behavior

Sean Kelly sean at invisibleduck.org
Tue Nov 6 13:07:10 PST 2012


On Nov 6, 2012, at 12:59 PM, Ali Çehreli <acehreli at yahoo.com> wrote:
> 
> I can't come up with an example but the spec is clear on that issue:
> 
>  http://dlang.org/class.html#destructors
> 
> "The garbage collector is not guaranteed to run the destructor for all unreferenced objects. Furthermore, the order in which the garbage collector calls destructors for unreference objects is not specified. This means that when the garbage collector calls a destructor for an object of a class that has members that are references to garbage collected objects, those references may no longer be valid. This means that destructors cannot reference sub objects."

This clause is mostly intended to say that the GC may not detect that every unreferenced object is truly unreferenced.  It's also possible, however, that the GC could delay finalizing collected objects until some later time.


More information about the Digitalmars-d-learn mailing list