Boost logo

Boost Users :

Subject: Re: [Boost-users] Object pools?
From: Ryan McConnehey (mccorywork_at_[hidden])
Date: 2010-02-16 22:38:45


"A flyweight is an object that minimizes memory use by sharing as much data as possible with other similar objects."  (http://en.wikipedia.org/wiki/Flyweight_pattern

The class for managing objects contains complete objects with no sharing between each other.  This is necessary because once a user is given the object it must behave as if the user had created it with the new command.

Diederick C. Niehorster wrote:
Hi Ryan,

I am not familiar with the library, nor the paradigm, but
Boost.FlyWeight seems to do something similar.

Best,
Dee

On Wed, Feb 17, 2010 at 9:31 AM, Ryan McConnehey <mccorywork@gmail.com> wrote:
  
I recently had to create a class that managed a pool of objects for the
user.  Instead of the user creating the object themselves they would ask the
class for an object.  The class would hand the user a boost::shared_ptr of
the object.  When the boost::shared_ptr needed to destroy the object it
handed it back to the class to reuse.  The class is designed for those areas
that need a lot of the same object but not all at the same time.  This class
has been useful for the boost::asio library where the async_receive and
async_write need the buffer to be valid until the callback occurs.  Other
people at my work have shown interest and I'm looking at needing to improve
the class to make it more general.  Instead of spending time doing the
improvements I would like to know if the boost libraries have anything like
what I described.  I'll looked through the descriptions but haven't seen
anything that comes close.

Ryan
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

    
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

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