when is the object destuctor called?

Derek Parnell derek at psych.ward
Mon May 22 17:07:59 PDT 2006


On Mon, 22 May 2006 18:45:52 +0200, Tom S wrote:

> Derek Parnell wrote:
>> On Tue, 23 May 2006 01:59:14 +1000, Jarrett Billingsley 
>> <kb3ctd2 at yahoo.com> wrote:
>>> Then, I have a static dtor which loops through all the textures and 
>>> deletes them.
>> 
>> I use the same technique. The idea that the only resource a ctor/dtor 
>> manages is RAM is plainly short-sighted.
> 
> IIRC, Walter's point was that objects that hold some important resources 
> should be manually memory-managed anyway. The GC is not guaranteed to 
> delete any objects, even these which aren't pointed to from a global 
> reference. This is because of the way the GC works. Maybe with a next GC 
> incarnation (e.g. a compacting one) *hint*, *hint*, we'll get stronger 
> guarantees ;)

I didn't mention 'GC'. I used the term 'dtor'. I do not equate the two
pieces of functionality. 

The 'dtor' is deconstruction functionality which should complement the
construction function.

The 'GC' is a mechanism to collect 'garbage' RAM. 

They are not the same thing.

-- 
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocracy!"
23/05/2006 10:05:19 AM



More information about the Digitalmars-d mailing list