[Gc] doubts: gc, gc_cleanup classes

MenTaLguY mental at rydia.net
Mon Feb 11 16:02:00 PST 2008


On Tue, 12 Feb 2008 12:22:08 +1300, "Bruce Hoult" <bruce at hoult.org> wrote:
> Your destructors will be run only if your program runs out of memory
> and the GC collects your objects.  I would not expect allocating five
> small objects to run you out of memory.

Note that a GCed object's destructor will only get called if its class
derives from gc_cleanup.  An object of a class derived simply from gc
will have its memory freed without the destructor getting called.

gc_cleanup does establish a virtual destructor, of course.

-mental



More information about the Gc mailing list