deprecated delete and manual memory management

Alexander aldem+dmars at nk7.net
Thu Apr 28 02:20:44 PDT 2011


On 28.04.2011 10:14, Dmitry Olshansky wrote:

> That's your C++ experience speaking ;) It seems you just like manual memory management in c++ and can't see other ways.

  This is not true, actually :) I agree, that GC is nice thing for most applications, and I really like it, but, I simply
  want to have an *option* to *control* memory allocation, if I choose to do so. Rarely, but I do need it (and not only me).

> Also dropping language constructs is no go. (this 'avoid' is too vague)

  I didn't say so - just referring to http://digitalmars.com/d/2.0/garbage.html, namely section "D Operations That Involve the Garbage Collector".

  RT & OS applications are constrained anyway, so I see no problem there. And no, "dropping GC" is not an option.

> OK, fighting implicit allocation. With what - refcounting?

  Manual management - whatever is this. malloc() with following free(), for instance - when there is no need anymore. But I prefer a bit more "natural" (not to everyone, of course) way - using delete.

  Even with GC, explicit delete may be useful (I've explained already, why).

>  Anyway, I just want to make sure you get the idea that GC is the default thing in D, not 'possible under certain circumstances' thing like it is in C++.

  Believe me, I do get that idea - using it for many years in Perl & C# :) And I am strictly "pro" GC in D as a default, just want to have more options, that's all - that's why I don't like when those options are phased out with no (obvious to me)
reason (which I want to find out).

/Alexander


More information about the Digitalmars-d mailing list