UPDATE
In the comments, answers and additional research, I came to the conclusion that usually there is a difference between setand a mapin terms of node overhead. My next question is valid:
How do you define node overhead for convenient use boost::pool_allocatoras a custom allocator?
And another update : service data node, probably will never exceed the size of 4 pointers, so a clean Boost Pool for sizeof(T), sizeof(T)+sizeof(int), sizeof(T) + 2*sizeof(int), sizeof(T) + 3*sizeof(int)and sizeof(T) + 4*sizeof(int)(or int64_tfor 64-bit systems) must be accurate. This is what I actually do, and it works.
I want to use the increase memory pool to manage tens of millions of small objects of the same size, avoiding calls to destructors of these objects, and instead freeing up memory in single rows containing many instances per shaft.
I sent another question about this problem, and the answer to this question made me realize that the question I really have to answer is the one I ask here.
:
class Obj {
typedef std::set<Obj, std::less<Obj>, boost::fast_pool_allocator<Obj>> fast_set_obj;
fast_set_obj * mset = new fast_set_obj;
mset->insert(Obj());
mset->insert(Obj());
...
boost::singleton_pool<boost::fast_pool_allocator_tag, sizeof(Obj const)>::purge_memory();
purge_memory() , , fast_pool_allocator , . ( Obj , , , , .)
. !
. set map, boost::pool_allocator, purge_memory()!
typedef std::map<int, int, std::less<int>,
boost::fast_pool_allocator<std::pair<int const, int>>>
fast_map_obj;
mast_map_obj * mmap = new fast_map_obj;
mmap[5] = Obj();
mmap[6] = Obj();
...
boost::singleton_pool<boost::fast_pool_allocator_tag,
sizeof(std::pair<int const, int>)>::purge_memory();
, . , boost::fast_pool_allocator - , , . sizeof , purge_memory(), - Boost Pool, ( , - ).
, , , , , , (.. , ), . , std::map , map, sizeof(Obj) sizeof(std::pair<int const, Obj>).
: - , ++ 11, , std::map boost::fast_pool_allocator?
?