Don't expect class destructors to be called at all by the GC

Bienlein jeti789 at web.de
Wed Jan 31 13:38:07 UTC 2018


On Thursday, 21 December 2017 at 18:45:27 UTC, Adam D. Ruppe 
wrote:
> On Thursday, 21 December 2017 at 18:20:19 UTC, H. S. Teoh wrote:
>> When the scoped destruction of structs isn't an option, 
>> RefCounted!T seems to be a less evil alternative than an 
>> unreliable class dtor. :-/
>
> Alas, RefCounted doesn't work well with inheritance...
>
> Though, what you could do is make the refcounted owners and 
> borrow the actual reference later.

Is there some summary of the things you have to be aware of when 
using the GC in D and not using the GC? I feel this would be very 
useful especially for people that are new to D or are not used to 
that kind of issues (because coming from a GCed language).


More information about the Digitalmars-d-learn mailing list