GC: memory collected but destructors not called

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Wed Nov 12 07:17:46 PST 2014


On 11/11/14 11:59 PM, Shachar Shemesh wrote:
> On 10/11/14 16:19, Steven Schveighoffer wrote:
>>
>> Only classes call dtors from the GC. Structs do not. There are many
>> hairy issues with structs calling dtors from GC. Most struct dtors
>> expect to be called synchronously, and are not expecting to deal with
>> multithreading issues.
>>
>> Note that structs inside classes WILL call dtors.
>
> How is this any different? If one should not be allowed, how is the
> other okay?

I'm not defending the status quo, I'm just saying what happens today.

But adding struct dtor calls to the GC will not solve the problems 
identified here.

-Steve


More information about the Digitalmars-d mailing list