[Boost-bugs] [Boost C++ Libraries] #2645: multimap size() returns bad count

Subject: [Boost-bugs] [Boost C++ Libraries] #2645: multimap size() returns bad count
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-01-08 16:41:27


#2645: multimap size() returns bad count
--------------------------------------------------------+-------------------
 Reporter: Daniel Christian <dan972_at_[hidden]> | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: Boost 1.38.0 | Component: interprocess
  Version: Boost 1.37.0 | Severity: Problem
 Keywords: |
--------------------------------------------------------+-------------------
 After exhausting all available shared memory by inserting objects into a
 multimap until a bad_alloc exception is thrown, then deleting all the
 objects that were successfully inserted, calling size() will still return
 1 even though the container is really empty. Also, memory is leaked if
 the exception is thrown during the insert as subsequent rounds of
 insert/delete cycles are able to insert less items than the iteration than
 came before it.

 Some info about my test scenario... The object that I'm inserting contains
 an interprocess vector and dynamically allocates an interprocess_mutex
 using the vector's shared memory allocator storing it's pointer in the
 object itself. Also, the size of the vector is dynamic, but is bounded to
 a maximum size so that the maximum size of an object can be predicted.

 I was able to work around this by performing a successful alloc/dealloc of
 a size equal to or larger than the size of the inserted object before
 doing the insert. If the alloc fails then I do not perform the insert.
 If I do this then the size() remains consistent and no memory is leaked.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/2645>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:49:59 UTC