Eliminate class allocators and deallocators?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Wed Oct 7 14:01:02 PDT 2009


dsimcha wrote:
> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>> dsimcha wrote:
>>> == Quote from Andrei Alexandrescu (SeeWebsiteForEmail at erdani.org)'s article
>>>> It is a bad idea because distinguishing between release of (expensive)
>>>> resources from dangerous memory recycling is the correct way to obtain
>>>> deterministic resource management within the confines of safety.
>>> This is based on two faulty assumptions:
>>>
>>> 1.  Memory is cheap.  (Not if you are working with absurd amounts of data).
>>> 2.  Garbage collection is never a major bottleneck.  (Sometimes it's a worthwhile
>>> tradeoff to add a few manual delete statements to code and sacrifice some safety
>>> for making the GC run less often.)
>> malloc.
>> Andrei
> 
> Kludge.  Requires using two separate heaps (inefficient) and worrying about
> whether your stuff is manually freed on all code paths, not just the ones that are
> executed often enough for performance to matter.

Au contraire, once the GC heap becomes safe, I have less to worry about.

Andrei



More information about the Digitalmars-d mailing list