Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::pool
From: Frank Meerkoetter (frank_at_[hidden])
Date: 2009-11-04 03:22:06


Zitat von strasser_at_[hidden]:

> Zitat von Frank Meerkoetter <frank_at_[hidden]>:
>
>>> as is expected. you might want to look into using thread specific
>>> pools, that
>>> only synchronize when a new pool block is allocated.
>>
>> could you please elaborate a bit on this? How would i do this with the
>> std::allocator implemenation provided by Boost.Pool?
>
> the basic idea is to have an object pool for each thread, so that only
> when the pool runs out of memory std::new is called and a mutex lock
> is required. thread-local allocations can run concurrently.
>
> you could use boost.pool for this, if none of your threads ever
> deallocate an object that was allocated by another thread (and thus be
> part of another pool). you`d have to write your own allocator I think.
> but boost.pool isn't suitable as a general purpose allocator anyway,
> because of O(n) free().

Thanks for your explanation. The property that objects that are allocated
in one thread must never be deallocated by a different thread is a show
stopper
for me. My current system is designed as a pipeline.

KR,
    Frank


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