custom memory management

Namespace rswhite4 at googlemail.com
Fri Feb 28 05:06:04 PST 2014


On Friday, 28 February 2014 at 12:54:32 UTC, Dicebot wrote:
> On Friday, 28 February 2014 at 12:36:48 UTC, Simon Bürger wrote:
>> If you are right that would mean that the current dmd/runtime 
>> does not follow the spec. Curious. The current implementation 
>> is not aware of strcut-destructors on the heap, i.e. the 
>> GC.BlkAttr.FINALIZE flag is not set for structs (or arrays of 
>> structs).
>
> Ah, structs are a bit tricky. Spec has override for struct 
> destructors that says explicitly "Destructors are called when 
> an object goes out of scope" so one can argue heap ignorance 
> matches it. But the very next line contradicts it : "Their 
> purpose is to free up resources owned by the struct object".
>
> I believe it is a DMD bug though. There is no reason why 
> destructors can't be run here. Most likely it is just defect of 
> current GC implementation that everyone got used to.
>
> This bug report discussion confirms it : 
> https://d.puremagic.com/issues/show_bug.cgi?id=2834
>
> Looks like decision was to fix it once precise GC gets added.

What can still take a long time. It annoys me very much that with 
arrays I can not rely on that the struct DTors are called.


More information about the Digitalmars-d-learn mailing list