Destructor/Finalizer Guarantees

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Nov 11 14:42:05 PST 2014


On Tue, 11 Nov 2014 22:31:17 +0000
Maxime Chevalier-Boisvert via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> What I want to know is: what 
> guarantees can I expect from destructor behavior?
destructors *may* be called eventually. or not. in any order. but never
twice.

think about object destructors as "finalizers". no calling order
guarantees, nor even guarantees that something will be called at all.

so if your VM becomes garbage, and registered objects are anchored only
by VM (i.e. there are no more references to that objects), destructors
can be called in any order.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141112/b54daaac/attachment.sig>


More information about the Digitalmars-d-learn mailing list