Boost logo

Boost Users :

From: Domagoj Babic (babic.domagoj_at_[hidden])
Date: 2008-08-05 16:39:05


Hi all,

I'm considering using boost::object_pool for my project. Reading the
code, I found
something that is seemingly suboptimal for my application:

destroy in boost::object_pool calls object_pool::free, which calls (eventually)
simple_segregated_storage::ordered_free. From the code (and documentation), it
seems to me that only simple_segregated_storage::malloc_n uses that ordering.

In my application, I don't need malloc_n, so the ordering is redundant.

My question is: How can I change the default behavior of object_pool so as to
use the simple, unordered O(1) free, which just adds the chunk to the beginning
of the list of free chunks?

I've (of course) read the documentation, but the only relevant sentences are
not very clear:

"Memory deallocation may be as simple as adding that chunk to the
front of the free
list, a O(1) operation. However, more complicated uses of Simple
Segregated Storage
may require a sorted free list, which makes deallocation O(N)."

I.e., since I don't need more complicated uses (I guess that's just
malloc_n, please
correct me if I'm wrong), I'd like O(1) deallocation.

Thank you in advance. Kind regards,

-- 
 Domagoj Babic
 http://www.domagoj.info/
 http://www.calysto.org/

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net