Boost logo

Boost Users :

From: Davi de Castro Reis (davicastro_at_[hidden])
Date: 2005-05-04 09:19:07


Hi,

I am trying to improve the performance of a std::list instance in a
multi-thread application using boost::pool, but the syncronization
overhead is killing me.

The point is that all access to my std::list are serialized, so I would
like my pool to not use mutexes when retrieving memory in the pool,
which is what I suppose is happening (got evidence through valgrind).

 From the template parameters of boost pool, I think this is possible,
but I couldn't figure out how to do this. Any tips here?

pseudo code:

struct X;
std::list<X *, boost::fast_pool_allocator<X *> > l;

lock();
//fill l with 1000 X * instances
unlock();

lock();
for (uint32 i = 0; i < 1000; ++i)
{
        X *x = l.front();
        l.erase(l.begin());
        l.push_back(x);
}
unlock();

Thanks in advance,
Davi de Castro Reis


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