views:

30

answers:

1

Have run into a bug with glibc's malloc(): http://sourceware.org/bugzilla/show_bug.cgi?id=4349 and am thinking a work around for now until updating to later version of glibc is to do pooled allocation for small objects that have many instances coming and going.

The small objects are all derived from an abstract base class. I'd like to find a good pattern (using boost is ok) to provide the pool allocation automatically in the base class and have it work properly for the many derived classes.

Would this be done by defining an operator new() in the abstract base class? How would it organize having different pools for each derived class that could have different actual memory size?

+1  A: 

One obvious starting point would be the Boost Pool library. Unfortunately, the model you want is one it doesn't provide yet, although it is listed as the sole item under "future directions". OTOH, this library hasn't been updated in a while now. The chances of it being updated to include that model really soon seems somewhat remote (at least to me).

Jerry Coffin