Proposal: GC and "delete"

Gregor Richards Richards at codu.org
Sun Apr 6 00:42:27 PDT 2008


Brian White wrote:
> Would it be possible to add a lightweight flag to the GC module to 
> detect if the GC was currently running?  That would allow an object to 
> conditionally delete sub-objects only if it was safe to do so (i.e. only 
> if not being deleted by the GC).
> 
> Alternatively, the "delete" could just do nothing at all during a GC 
> pass.  This would probably be the safest solution.
> 
> -- Brian

The only time you would have user code running while the GC is running 
is in a destructor, and you shouldn't be accessing heap objects that 
potentially need to be deleted from the destructor anyway, since the 
order of destruction is unpredictable.

  - Gregor Richards



More information about the Digitalmars-d mailing list