Boost logo

Boost Users :

Subject: Re: [Boost-users] Object pools?
From: Michele Caini (michele.caini_at_[hidden])
Date: 2010-02-17 11:45:41


Il 17/02/2010 17:18, Ryan McConnehey ha scritto:
> michele.caini_at_[hidden] wrote:
>> Simply, That's not as a pool have to work. You are looking for
>> something that is a pool but working not as a pool does.
> Then what is the definition of a pool? Do you mean that I'm looking for
> something that is a pool but doesn't work like a Boost.pool?
>
> Ryan

No, sorry. I mean that pool has responsability for manage offered
objects, and so it manages them along their life time. Pool will create
objects, pool will release and reclaim objects, and pool will delete
objects. That's all.

You are looking for something that create objects and forbid about them,
until you return that objects to the home. Is correct?
Really, it's possible but it is not as a pool works, simply.

Your idea breaks also raii pattern and you risk to have memory leaks,
because not reclaimed objects maybe be lost during their life time.
So, in my opinion, it is not a good idea. I think that is better to
create a pool of object during pool construction, so delete them during
destruction, eventually resizing pool during use.

What about a monostate pattern that globally manages objects as a pool
and will be destroyed only when program terminates? That's can be a
valid alternative, or not?


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