Linus with some good observations on garbage collection

Sean Kelly sean at invisibleduck.org
Mon Apr 25 11:43:47 PDT 2011


On Apr 24, 2011, at 1:17 PM, Andrei Alexandrescu wrote:
> 
> It is much better in very many ways, in particular in D. For one simple argument, consider:
> 
> auto obj = new Widget;
> 
> Simple modularity considerations would require this operator to have semantics independent of Widget, such that modular and generic code can use it properly. Custom class allocators ruin all that, because they would require the use of delete paired with new, whereas the general operator requires no action.

Agreed, so long as there's some form of support for placement new.  But that could easily be an explicit __ctor() call into the allocated space, which works in D but I don't believe it works in C++ (thus the explicit placement new syntax).


More information about the Digitalmars-d mailing list