Boost logo

Boost Users :

Subject: Re: [Boost-users] fast_pool_allocator question
From: Brad Howes (bradley.howes_at_[hidden])
Date: 2011-06-14 10:41:02


On Jun 14, 2011, at 1:17 PM, steviekm3 wrote:

> I was wondering if fast_pool_allocator will speed something up.
>
> I have a funtion say g which looks like:
>
> void g( Params p )
> {
> std::map<double,Foo> m;
> for( int i = 0; i < 100000; ++it )
> {
> m.insert( ... )
> }
> }
>
> g gets called from about 100 different threads running on 16 processor
> machine. All the processors are not being used near full capacity. I did
> some analysis and find that most of the time one thread is in malloc system
> call and other threads are blocking on it. ( I guess malloc only allows
> serial access a certain points ).
>
> Would a fast_pool_allocator speed this up. Could I pre-allocate the memory
> needed using a fast_pool_allocator ? I don't want the pool to return
> memory to the system. Just to reuse memory that is no longer needed ( reuse
> memory that m has used after m goes out of scope ).

I had great success using pool allocators. But you would definitely win if you could have a pool / thread rather than a shared pool.

Brad

-- 
Brad Howes
Calling Team - Skype Prague
Skype: br.howes

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