Flushing vectors by swap tricks smoothes memory requirements

This commit is contained in:
DennisOSRM 2011-12-01 15:13:35 +01:00
parent 9abb317e6d
commit 21c9132902

View File

@ -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 );