shared_ptr with memory pool

2003-07-27
2003-07-27
  • Jason Leger
    Jason Leger
    2003-07-27

    Hi,

    The program I am writing will create and delete a lot of objects. 
    These objects will be referenced from multiple places.

    Obviously, I need a shared_ptr, however, I am worried about the performance during creation and deletion

    Can you use a boost::pool interface with the shared_ptr?

    I have tried using the pool, object_pool, singleton_pool interfaces but I can't get the constructor to run on my object.

    If I use the pool_alloc interface I have to use a container.

    Basically, I want to allocate objects from a memory pool and have these object pointed to by smart/shared_ptr so that when all of the references to the object are gone the object is deleted.

    Can anyone help me?