Manual memory management in D2
Bruno Medeiros
brunodomedeiros+spam at com.gmail
Mon Jul 19 07:01:43 PDT 2010
On 13/07/2010 19:36, Andrei Alexandrescu wrote:
> free(). But manual deletion has no business in the garbage collected
> heap. That currently druntime provides it is an accident caused by the
> current implementation; most GC's cannot provide efficient manual
> reclamation. And they shouldn't anyway.
>
> (There's a longer discussion underneath this concerning what memory
> really is and what GCs really are and do.)
>
>
> Andrei
Why not simply make 'delete' an operation that states "I assert that
there are no references to this object, and it will no longer be used."
The GC is then free to do whatever it wants with the object, claim its
memory now, or later, etc.. Surely then, 'delete' is never an
unefficient operation?
Is that what clear() does? I'm not sure what exactly clear() does, I
wasn't able to find definite information on it.
--
Bruno Medeiros - Software Engineer
More information about the Digitalmars-d
mailing list