heap fragmentation & operator new

Burlen Loring burlen.loring@kitware.com
Sun Jun 22 17:11:00 GMT 2008


Hi all,

We have some complaints from our users that if we do not use 
malloc/realloc/free inside our container class, and rather we use 
operator new/delete, that we have heap fragmentation problem that leads 
to their running out of memory. We have evidence that its true and 
additionally we see that additionally realloc gives performance 
advantage. Is there anything we can do to actively combat heap 
fragmentation when using new/delete?  We already do the simple things 
like double the current size of the container if we need to extend. Can 
we tell the heap to de-fragment itself somehow? Are there any tools for 
dynamically observing the state of the heap? Are we "shooting our selves 
in the foot"(in terms of running out of memory) by using malloc and new 
together in the same library? Are there any must read books/documents 
that I should have read on this topic?

thanks in advance
Burlen



More information about the Gcc-help mailing list