forked from organicmaps/organicmaps
[routing] Efficient usage of virtual memory
This commit is contained in:
parent
376420445b
commit
6b1eb715ee
1 changed files with 26 additions and 1 deletions
|
@ -185,7 +185,6 @@ void OsrmRouter::CalculateRoute(m2::PointD const & startingPt, ReadyCallback con
|
|||
|
||||
m_container.Open(fPath);
|
||||
|
||||
m_dataFacade.Load(m_container);
|
||||
m_mapping.Load(m_container);
|
||||
}
|
||||
catch (Reader::Exception const & e)
|
||||
|
@ -226,10 +225,25 @@ void OsrmRouter::CalculateRoute(m2::PointD const & startingPt, ReadyCallback con
|
|||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_mapping.Clear();
|
||||
m_dataFacade.Load(m_container);
|
||||
}
|
||||
catch(Reader::Exception const & e)
|
||||
{
|
||||
LOG(LERROR, ("Error while loading routing data:", fPath, e.Msg()));
|
||||
resGuard.SetErrorMsg("Routing data absent or incorrect.");
|
||||
return;
|
||||
}
|
||||
|
||||
rawRoute.segment_end_coordinates.push_back(nodes);
|
||||
|
||||
pathFinder({nodes}, {}, rawRoute);
|
||||
|
||||
// unmap routing data
|
||||
m_dataFacade.Clear();
|
||||
|
||||
if (INVALID_EDGE_WEIGHT == rawRoute.shortest_path_length
|
||||
|| rawRoute.segment_end_coordinates.empty()
|
||||
|| rawRoute.source_traversed_in_reverse.empty())
|
||||
|
@ -238,6 +252,17 @@ void OsrmRouter::CalculateRoute(m2::PointD const & startingPt, ReadyCallback con
|
|||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
m_mapping.Load(m_container);
|
||||
}
|
||||
catch(Reader::Exception const & e)
|
||||
{
|
||||
LOG(LERROR, ("Error while loading routing index:", fPath, e.Msg()));
|
||||
resGuard.SetErrorMsg("Routing index absent or incorrect.");
|
||||
return;
|
||||
}
|
||||
|
||||
// restore route
|
||||
vector<m2::PointD> points;
|
||||
for (auto i : osrm::irange<std::size_t>(0, rawRoute.unpacked_path_segments.size()))
|
||||
|
|
Loading…
Add table
Reference in a new issue