Destructors and Deterministic Memory Management
georg.wrede at iki.fi
Sun May 3 10:35:49 PDT 2009
> Two closely related topics here:
> 1. It is often nice to be able to create a single object that works with both
> GC and deterministic memory management. The idea is that, if delete is called
> manually, all sub-objects would be freed deterministically, but the object
> could still safely be GC'd. Since the destructor called by the GC can't
> reference sub-objects, would it be feasible to have two destructors for each
> class, one that is called when delete is invoked manually and another that is
> called by the GC?
This one you already can do. Just write a myDestructor() that does
whatever you need, and then call it when necessary.
More information about the Digitalmars-d