Best memory management D idioms

XavierAP via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Mar 6 02:35:48 PST 2017


On Monday, 6 March 2017 at 08:26:53 UTC, Eugene Wissner wrote:
> The memory management in D is becoming a mess.

I am aware this is a hot topic, hence the opening joke. But I 
just want to learn what toolboxes are currently available, not 
really discuss how adequate they are, or how often GC is adequate 
enough. Neither how much % GC-haram Phobos or other libraries are 
internally atm. There are several threads already discussing 
this, which I've browsed.

My impression so far is that dlib's New/Delete is the most 
straightforward or efficient tool, and it can kind of cover all 
the bases (and is GC-halal), as far as I can tell in advance. 
Plus it has printMemoryLog() as a bonus, which is already better 
than C++ new/delete. Just an observation that it doesn't provide 
an option to allocate an uninitialized array, considering that 
this module is already targeting performance applications.

Not sure if I would use any other tool (besides GC itself). I'm 
curious about Unique but it's not fully clear to me what happens 
(regarding lifetime, deterministic destruction, GC monitoring) 
when you need to call "new" to use it.


More information about the Digitalmars-d-learn mailing list