custom memory management

Namespace rswhite4 at googlemail.com
Fri Feb 28 06:08:09 PST 2014


On Friday, 28 February 2014 at 13:38:59 UTC, Dicebot wrote:
> On Friday, 28 February 2014 at 13:32:33 UTC, Namespace wrote:
>> I will vote, too. It's somewhat strange: Since it works with 
>> delete it should also work with the current GC, or? Someone 
>> should figure out why and how delete works this way. :)
>
> Well, delete is deprecated so it can do any kind of arcane 
> horrors :)
>
> More idiomatic destroy + GC.free pair will work because destroy 
> is a template function.

No, currently it is not deprecated. It is suggested to be 
deprecated. :P
And destroy doesn't finalize the data. :/ See: 
http://forum.dlang.org/thread/bug-12256-3@https.d.puremagic.com%2Fissues%2F 
and 
http://forum.dlang.org/thread/bug-12274-3@https.d.puremagic.com%2Fissues%2F
But that is only a workaround. I don't want to call every time 
"arr.finalize" because the GC is silly...
I meant that someone should analyse the internal delete code and 
implement something like this for the current GC related to 
struct arrays (and AA's).


More information about the Digitalmars-d-learn mailing list