Using less RAM, Fixing a leak in ContractionCleanup.
This commit is contained in:
parent
897f328b45
commit
a9b76e8050
@ -125,6 +125,7 @@ public:
|
|||||||
heap.resize( 1 );
|
heap.resize( 1 );
|
||||||
insertedNodes.clear();
|
insertedNodes.clear();
|
||||||
heap[0].weight = 0;
|
heap[0].weight = 0;
|
||||||
|
nodeIndex.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
Key Size() const {
|
Key Size() const {
|
||||||
@ -183,13 +184,6 @@ public:
|
|||||||
return insertedNodes[removedIndex].node;
|
return insertedNodes[removedIndex].node;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeleteAll() {
|
|
||||||
for ( typename std::vector< HeapElement >::iterator i = heap.begin() + 1, iend = heap.end(); i != iend; ++i )
|
|
||||||
insertedNodes[i->index].key = 0;
|
|
||||||
heap.resize( 1 );
|
|
||||||
heap[0].weight = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DecreaseKey( NodeID node, Weight weight ) {
|
void DecreaseKey( NodeID node, Weight weight ) {
|
||||||
const Key index = nodeIndex[node];
|
const Key index = nodeIndex[node];
|
||||||
Key key = insertedNodes[index].key;
|
Key key = insertedNodes[index].key;
|
||||||
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
or see http://www.gnu.org/licenses/agpl.txt.
|
or see http://www.gnu.org/licenses/agpl.txt.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef CONTRACTIONCLEANUP_H_INCLUDED
|
#ifndef CONTRACTIONCLEANUP_H_INCLUDED
|
||||||
#define CONTRACTIONCLEANUP_H_INCLUDED
|
#define CONTRACTIONCLEANUP_H_INCLUDED
|
||||||
@ -234,6 +234,9 @@ private:
|
|||||||
}
|
}
|
||||||
cout << "Removed " << _graph.size() - usefull << " useless shortcuts" << endl;
|
cout << "Removed " << _graph.size() - usefull << " useless shortcuts" << endl;
|
||||||
_graph.resize( usefull );
|
_graph.resize( usefull );
|
||||||
|
for ( int threadNum = 0; threadNum < maxThreads; ++threadNum ) {
|
||||||
|
delete threadData[threadNum];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template< class EdgeAllowed, class StallEdgeAllowed > void _ComputeStep( _Heap* heapForward, _Heap* heapBackward, const EdgeAllowed& edgeAllowed, const StallEdgeAllowed& stallEdgeAllowed, NodeID* middle, int* targetDistance ) {
|
template< class EdgeAllowed, class StallEdgeAllowed > void _ComputeStep( _Heap* heapForward, _Heap* heapBackward, const EdgeAllowed& edgeAllowed, const StallEdgeAllowed& stallEdgeAllowed, NodeID* middle, int* targetDistance ) {
|
||||||
@ -250,7 +253,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( distance > *targetDistance ) {
|
if ( distance > *targetDistance ) {
|
||||||
heapForward->DeleteAll();
|
heapForward->Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for ( int edge = _firstEdge[node], endEdges = _firstEdge[node + 1]; edge != endEdges; ++edge ) {
|
for ( int edge = _firstEdge[node], endEdges = _firstEdge[node + 1]; edge != endEdges; ++edge ) {
|
||||||
|
@ -126,7 +126,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( distance > *_upperbound ) {
|
if ( distance > *_upperbound ) {
|
||||||
_forwardHeap->DeleteAll();
|
_forwardHeap->Clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for ( typename GraphT::EdgeIterator edge = _graph->BeginEdges( node ); edge < _graph->EndEdges(node); edge++ ) {
|
for ( typename GraphT::EdgeIterator edge = _graph->BeginEdges( node ); edge < _graph->EndEdges(node); edge++ ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user