Hello,
In my application I use singleton pools for the 2 most common
allocation scenarios:
1) Frequent allocation of small objects (one by one, tens to hundreds
per second). Every object is disposed soon after its allocation, so
that only few objects are alive simultaniously.
Since the objects are accessed through shared_ptr, I allocate them as follows:
allocate_shared<Obj>(boost::fast_pool_allocator<Obj>());
Is this the appropriate use of Pool for this scenario? Should I use
pool_allocator (i.e. ordered_malloc()) instead?
2) Frequent (same as in (1) frequency and lifetime) allocation of
memory blocks that look like this: [10Kb, 1Kb, 1.1Kb, 0.9Kb,...
10.5Kb...] - i.e. 1 big block, then several small ones. Each block is
stored in shared_array, and I allocate it this way:
shared_array<char> data_;
//...
typedef boost::singleton_pool