[Boost-bugs] [Boost C++ Libraries] #9108: flat_map leaks on insert(Iterator, Iterator)

Subject: [Boost-bugs] [Boost C++ Libraries] #9108: flat_map leaks on insert(Iterator, Iterator)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2013-09-12 20:17:10


#9108: flat_map leaks on insert(Iterator, Iterator)
------------------------------+------------------------
 Reporter: adam.m.baxter@… | Owner: igaztanaga
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: container
  Version: Boost 1.54.0 | Severity: Problem
 Keywords: |
------------------------------+------------------------
 Reproducer:

 #include <iostream>
 #include <boost/container/flat_map.hpp>

 typedef boost::container::flat_multimap<int,int> IntMap;

 class MapTest {
 public:
     MapTest() {}
     MapTest(IntMap const &map) :
         _map(map) {
         _map.insert(map.begin(), map.end());
     }
     IntMap const& getMap() {return _map; }
 private:
     IntMap _map;
 };

 int main(int argc, char *argv[]) {

     using std::cout;
     using std::endl;

     IntMap iMap;
     for(int i = 0; i < 1000; i++) {
         iMap.emplace(i, i);
     }

     MapTest map(iMap);
     for(auto const &kvPair : map.getMap()) {
         cout << kvPair.first << " : " << kvPair.second << endl;
     }
     return 0;
 }

 Valgrind Output:

 ==15820==
 ==15820== HEAP SUMMARY:
 ==15820== in use at exit: 8,000 bytes in 1 blocks
 ==15820== total heap usage: 20 allocs, 19 frees, 49,624 bytes allocated
 ==15820==
 ==15820== 8,000 bytes in 1 blocks are definitely lost in loss record 1 of
 1
 ==15820== at 0x4A068F3: operator new(unsigned long) (in
 /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
 ==15820== by 0x4016EF:
 MapTest::MapTest(boost::container::flat_multimap<int, int, std::less<int>,
 std::allocator<std::pair<int, int> > > const&) (in
 /home/abaxter/Projects/Du/apollo-build/bin/sandbox)
 ==15820== by 0x4013B9: main (in /home/abaxter/Projects/Du/apollo-
 build/bin/sandbox)
 ==15820==
 ==15820== LEAK SUMMARY:
 ==15820== definitely lost: 8,000 bytes in 1 blocks
 ==15820== indirectly lost: 0 bytes in 0 blocks
 ==15820== possibly lost: 0 bytes in 0 blocks
 ==15820== still reachable: 0 bytes in 0 blocks
 ==15820== suppressed: 0 bytes in 0 blocks
 ==15820==

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/9108>
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:50:14 UTC