January 06, 2004
As D is a GC language, does that mean that ~this() is kinda redundant, except when using auto classes ? When should one use an auto class? In the destructor of an auto class, should all dynamic resources be deleted explicitly ?


January 07, 2004
imr1984 wrote:
> As D is a GC language, does that mean that ~this() is kinda redundant, except
> when using auto classes ? When should one use an auto class? In the destructor
> of an auto class, should all dynamic resources be deleted explicitly ?

Destructors are mainly used to deallocate resources that are not under the GC's thumb.  When interfacing with C libraries, for instance, you typically get pointers to structs (or whatever) from the library. Unless the library itself was coded in D, you nede to free it explicitly.  Destructors are the place to do it.

 -- andy