Fisher Mark wrote:
>
> > One C++ problem I just found out is memory management. It seems
> > that it's impossible to 'new' an object from an specified memory block.
> > So it's impossible to put free'd objects in memory pool and re-allocate
> > them next time.
>
> It can't be done by the default new operator, but you can do it with an
> overloaded new operator. An overloaded operator new can do whatever you
> need it to do -- I've got 9-year old code that does arena allocation and
> reference counting by overloading new.
It can be done using 'placement new', for which you do not have to
override any operator. See Stroustrup 3rd edition, 10.4.11, 'Placement
of objects".
Cheers,
Hildo