GCC provides several extension distributors as an alternative to std::allocator .
You really did not say what your requirements are, so you cannot say whether any of them suits you.
Edit the following OP edit:
Let's say I want to use std::list for many small objects, then the std::allocator implementations that allocate each object with ::new cause significant overhead at runtime (but also memory).
Why and memory? The overhead of additional pointers in each std::list node will be presented regardless of whether the memory comes from new or a custom allocator. You just mean heap bookkeeping to keep track of all the minor markups?
It is much more efficient to isolate large pieces of objects and distribute them one by one.
Did you measure it?
If you do not want the overhead of allocating a large number of individual nodes, are you sure that std::list is the right container? What about vector or deque ?
boost::stable_vector is still node, but has lower memory costs than std::list .
A boost::flat_map<int, T> not a node and can be used instead of std::list<T>
Distributors are complex and not always the best answer to (real or perceived) problems.
source share