Boost logo

Boost Users :

Subject: Re: [Boost-users] newbie: help to start with object_pool
From: Roman Shmelev (rshmelev_at_[hidden])
Date: 2009-10-08 11:07:38


> 1. Is object_pool suitable for this purpose?
I guess, yes

> 2. Does object_pool.free() returns object memory to the pool or return
> pool's memory to the system?
I guess, it will reuse memory, but will not return it to system unless
purge() method is called
or the pool is destroyed. At least this is my experience while working
with pool and object_pool.

> 3. How do I use object_pool.construct()? I didn't get the number of
> parameters requirement in the documentation
You provided link that says about:
"t.construct(???) - ElementType must have a constructor matching ???;
the number of parameters given must not exceed what is supported
through pool_construct" - so it seems to be ready for any constructor
params.

Hope this helps.
If you will do tests then note, that on non-fragmented memory using
object_pool->construct vs new/delete may give similar results.
When object pool is useful - when you work with fragmented memory.


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