Destructor semantics

Rainer Deyke rainerd at eldwood.com
Thu Aug 12 09:48:59 PDT 2010


On 8/12/2010 06:59, Joe Greer wrote:
> Logically speaking if an object isn't destructed, then it lives forever 
> and if it continues to hold it's resource, then we have a programming 
> error.  The GC is for reclaiming memory, not files.  It can take a long 
> time for a GC to reclaim an object and you surely don't want a file 
> locked for that long anymore than you want it held open forever.

Furthermore, the GC is conservative, so it isn't guaranteed to collect
any particular object at all, even if manually invoked.  (This also
means that any D program that relies in the GC potentially leaks memory.)


-- 
Rainer Deyke - rainerd at eldwood.com


More information about the Digitalmars-d mailing list