B
Barry
As boost:
ool_alloc use singleton holder for pool allocator, client
programmers have to reclaim the memory by hand through calling
singleton_pool<alloc_tag, elem_size>:
urge_memory() or something to
release the memory, so the program should have knowledge of the
elem_size, sometime, it's impossible or at least hard to know the size
of the element allocated by the allocator.
for example:
struct my_tag
list<int, boost:
ool_allocator<int> > List;
.....
boost::singleton_pool<boost:
ool_allocator_tag,
sizeof(_List_node)>::release_memory()
Here _List_node is the real element that is dynamic created by
allocator, so if I use sizeof(int) instead, it does NOT work
programmers have to reclaim the memory by hand through calling
singleton_pool<alloc_tag, elem_size>:
release the memory, so the program should have knowledge of the
elem_size, sometime, it's impossible or at least hard to know the size
of the element allocated by the allocator.
for example:
struct my_tag
list<int, boost:
.....
boost::singleton_pool<boost:
sizeof(_List_node)>::release_memory()
Here _List_node is the real element that is dynamic created by
allocator, so if I use sizeof(int) instead, it does NOT work