Manual memory management in D2

Robert M. Münch robert.muench at robertmuench.de
Mon Jul 12 01:01:20 PDT 2010


On 2010-07-12 05:03:06 +0200, Petr said:

> Ok, so I now know how to explicitly free memory allocated to the GC 
> heap. Now the question is, should we have the usual C* c = new C(), and 
> I wanted to allocate it to unmanaged memory(just like it would in C++) 
> and then at some
> point call the destructor on it and free the memory, outside of the GC. 
> How would I do that?

Yes, that's something I need to, because I need to allocate memory from 
a special pool, the GC doesn't know about. And I need to handle freeing 
of such a memory myself because it's persistent and surviving 
application start-overs.

-- 
Robert M. Münch
http://www.robertmuench.de



More information about the Digitalmars-d mailing list