On Wednesday, 9 September 2015 at 15:37:50 UTC, Q wrote:
Yes, but according to the specs it is not guaranteed that the GC calls the DTor if the Object is collected.

Where? This page says pretty plainly:

http://dlang.org/class.html#destructors

"The garbage collector calls the destructor function when the object is deleted."

(this is arguably a mistake, dtor and finalizer being the same thing have been a problem before, but it does say that)

This sentence: "The garbage collector is not guaranteed to run the destructor for all unreferenced objects. " is because the GC is conservative and has a few exceptions in what it covers. But if you aren't one of those exceptions (data segment, or pinned by a false pointer (very rare in 64 bit btw), it will be collected and if it is collected, the dtor is run.

Reply via email to