== Quote from Andrei Alexandrescu ([email protected])'s article > dsimcha wrote: > > == Quote from Andrei Alexandrescu ([email protected])'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.
So for placement construction of a class, I guess it would look something like: auto x = cast(MyClass) malloc(MyClass.classinfo.init.length); x.__ctor( a, b, c ); // construct ... x.__dtor(); free( cast(void*) x ); Is that right?
