custom memory management

Dicebot public at dicebot.lv
Fri Feb 28 06:47:30 PST 2014


On Friday, 28 February 2014 at 14:08:11 UTC, Namespace wrote:
> 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...

"intended to be deprecated" is a better word. There is not a 
smallest chance it will stay in the long term, better get used to 
it.

Quick solution would have been to merge "finalize" with destroy 
itself. As I have mentioned, it is a template and has all 
necessary information for traversal.

Proper solution will be to fix the struct destructor bug as it is 
the root cause for your array issues too and then patch destroy 
to only do traversal when pointers are not owned by GC.

> 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).

I am too scared of what I may find :)


More information about the Digitalmars-d-learn mailing list