From 21c913290217df4b96634b02a1b47ad40528a03f Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Thu, 1 Dec 2011 15:13:35 +0100 Subject: [PATCH] Flushing vectors by swap tricks smoothes memory requirements --- Contractor/Contractor.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Contractor/Contractor.h b/Contractor/Contractor.h index 7d40e29ff..c8d9568e8 100644 --- a/Contractor/Contractor.h +++ b/Contractor/Contractor.h @@ -495,6 +495,7 @@ private: bool _UpdateNeighbours( std::vector< double >* priorities, std::vector< _PriorityData >* const nodeData, _ThreadData* const data, NodeID node ) { std::vector< NodeID >& neighbours = data->neighbours; neighbours.clear(); + std::vector< NodeID>().swap(neighbours); //find all neighbours for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) { @@ -521,6 +522,7 @@ private: std::vector< NodeID >& neighbours = data->neighbours; neighbours.clear(); + std::vector< NodeID>().swap(neighbours); for ( _DynamicGraph::EdgeIterator e = _graph->BeginEdges( node ) ; e < _graph->EndEdges( node ) ; ++e ) { const NodeID target = _graph->GetTarget( e );