Subject: Re: [Boost-bugs] [Boost C++ Libraries] #2908: unordered_map has no destructor!
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-04-27 16:05:00
#2908: unordered_map has no destructor!
---------------------------+------------------------------------------------
Reporter: anonymous | Owner: danieljames
Type: Bugs | Status: closed
Milestone: Boost 1.39.0 | Component: unordered
Version: Boost 1.37.0 | Severity: Problem
Resolution: invalid | Keywords: unordered_map,destructor
---------------------------+------------------------------------------------
Changes (by anonymous):
* version: Boost 1.38.0 => Boost 1.37.0
Comment:
Here is the example (I tried to skip the unnecessary stuff):
definitions:
typedef boost::tuple<TPoint, TPoint, TPoint> TEdgeIdentifier;
typedef std::pair<PTempPlzEdge, unsigned> TCountedEdge;
typedef boost::unordered_map<TEdgeIdentifier, TCountedEdge,
TEdgeIdentifierHash, TEdgeIdentifierEqual> TEdgeCountMap;
method:
-------
TEdgeCountMap EdgeCountDifferentMap( 1.5 * List.size() );
for( "it in List" ){
TEdgeCountMap::iterator found = EdgeCountDifferentMap.find(
(*it)->GetEdgeIdentifier() );
if( found != EdgeCountDifferentMap.end() ){
if( "some condition" ){
found->second.second ++;
}
}else{
EdgeCountDifferentMap.insert( std::make_pair(
(*it)->GetEdgeIdentifier(), std::make_pair( *it , 1 ) ) );
}
}
for( "it in List" ){
TEdgeCountMap::iterator found = EdgeCountDifferentMap.find(
(*it)->GetEdgeIdentifier() );
if( found != EdgeCountDifferentMap.end() && found->second.second > 1 ){
continue;
}
"do something with *it"
}
// EdgeCountDifferentMap.clear(); // if this is uncommented, I have a huge
memory leak although this is the end of the method and
EdgeCountDifferentMap should be destroyed
Additionally I noticed (using AQtime 6) that the memory that is allocated
within the constructor call
"TEdgeCountMap EdgeCountDifferentMap( 1.5 * List.size() );"
is not freed too.
I am in the unfortunate situation that I have to use Borland C++ Builder
4.
I use boost version 1.37.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/2908#comment:4> 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:00 UTC