Hi,

I'm using boost::pool for (evidently) allocating memory for a whole bunch of objects (thanks Stephen Cleary for pool). Most of the time the objects are entirely independent, however, from time to time, I'd like to iterate through all the allocated objects (in this case to generate some test statistics over then). To do this I keep a list of pointers to everything I've allocated. The time spent keeping this list up to date, particularly removing an object, is significant.

One possible (and very nice fix) would be to have a pool_iterator that let me, as I said, iterated through the allocated objects. As far as I can tell, this doesn't exist. Does anyone have any comments on whether this is a good idea, whether it's feasible, and perhaps how I might go about it?

The pools don't seem to have a bit-map of free blocks - and traversing the free list at every increment would be horribly slow. I have a "holey_vector" that uses a vector as storage, and keeps a sorted list of free indexes, but I can't imagine this approach would work in a pool, where the storage is a list of blocks at non-increasing addresses. Marking blocks as free at the beginning of the block would take up at worst a whole alignment worth of memory, kind of defeating the point of the pool.

So I'm guessing the best approach would be a bit map of free blocks. Comments?

cheers,
goof

--
Geoff Leyland
Laboratoire d'energetique industrielle
LENI-DGM-EPFL, CH-1015, Lausanne, Switzerland
Phone: +41 (21) 693 3505, Fax: +41 (21) 693 35 02

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to