Is there any memory allocation library that provides talloc-like pools and is specifically designed to play well with C++'s features?
In particular:
I can predict in advance how big a pool needs to be. There is no risk that I might accidentally overflow it.
If I allocate an object in a pool, I will not need to reclaim its storage until the whole pool is deallocated. (So objects can simply be sequentially allocated in the pool, causing no more waste than the insertion of padding to account for the alignments of different types.)
I need the ability to allocate objects of various sizes and alignments in a single pool.
I need to store the elements of standard library containers in pools. (In the particular case of
std::vector
s, I will set the capacity of the internal buffer at construction time, and then I will not attempt to further grow the vector.)
What I do not want to do is:
- Reinvent destructors.
- Reinvent exceptions.
- Reinvent standard library containers.
- Use
void *
.