Garbage Collection, Allocators/Deallocators and

Ivo Kasiuk i.kasiuk at gmx.de
Sun Sep 19 04:31:58 PDT 2010


> > Ok, that makes sense. So the deallocators really should not get called
> > in this case. But why are the destructors not invoked when the GC
> > finalizes the objects?
> 
> For S1 and S2, this is a known bug - destructors of structs on the heap
> don't get called.

Ah, I see. You mean #2834. That explains it, thanks.

> As for C1, I have no idea what's happening. Definitely a bug, though.

I am not sure that it is a bug that ~C1 (and also ~S1) is not invoked.
After all, we called GC.malloc manually. So the GC knows about the
memory region but is possibly not aware that it contains the object. If
this is true it would be logical that the memory is freed but the
destructor is not called.




More information about the Digitalmars-d-learn mailing list