GC.BlkAttr.FINALIZE

Namespace rswhite4 at googlemail.com
Sat Mar 1 06:57:44 PST 2014


On Saturday, 1 March 2014 at 01:28:06 UTC, Steven Schveighoffer 
wrote:
> On Fri, 28 Feb 2014 18:45:50 -0500, Namespace 
> <rswhite4 at googlemail.com> wrote:
>
>>> We need a precise GC to get struct dtors to work, the 
>>> alternative would be extremely hackish.
>>
>> Since I expect/fear that such a implementation is not done in 
>> the next 12 months: what would be the alternative?
>
> Examine the GC code, and figure out a way to hook the 
> finalizer. Look for FINALIZE.
>
> Another crude but effective option would be to wrap the struct 
> in a class. May not actually be that bad, depending on the size 
> of the struct (blocks come in chunks of 16, 32, 64, etc.).
>
> -Steve

I tried to enable the printf's in rt/lifetime.d (e.g.: 
https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/rt/lifetime.d#L1125) 
to see what happens if I/the GC delete an array. But I see no 
output, no matter what I try to allocate/deallocate.


More information about the Digitalmars-d-learn mailing list