More radical ideas about gc and reference counting

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Fri May 2 09:20:53 PDT 2014


On 5/2/14, 9:04 AM, fra wrote:
> On Wednesday, 30 April 2014 at 20:21:33 UTC, Andrei Alexandrescu wrote:
>> I think there's no need to argue that in this community. The GC never
>> guarantees calling destructors even today, so this decision would be
>> just a point in the definition space (albeit an extreme one).
>
> I think I (we) need a bit of clarification.
> Docs in http://dlang.org/class.html#destructors states that: "The
> garbage collector calls the destructor function when the object is
> deleted."
> As far as I understand, this means that destructors are always called
> when an instance is collected. Is this right?
> Doesn't this mean that destructors are guaranteed to run for
> unreferenced objects if we force the GC to do a full collect cycle?

False pointers make it seem like unreferenced objects are in fact 
referenced, so fewer destructors will run than there should. -- Andrei



More information about the Digitalmars-d mailing list