Search code examples
c++boostboost-pool

Boost Singleton Pool release_memory vs purge_memory


Where can I find the difference between purge_memory and release_memory in Boost Singleton Pool? In here it says:

Singleton Usage is the method where each Pool is an object with static duration; that is, it will not be destroyed until program exit. Pool objects with Singleton Usage may be shared; thus, Singleton Usage implies thread-safety as well. System memory allocated by Pool objects with Singleton Usage may be freed through release_memory or purge_memory.


Solution

  • Clicking a few links on your page leads to this page.

    There you can read the following:

    t.release_memory()  bool    t must be ordered. Frees every memory block that doesn't have any
                    allocated chunks. Returns true if at least one memory block was freed.
    
    t.purge_memory()    bool    Frees every memory block. This function invalidates any pointers
                    previously returned by allocation functions of t. Returns true if at
                    least one memory block was freed.