Log helpful error message if mmap fails.

This commit is contained in:
Daniel Patterson
2016-12-07 11:42:13 -08:00
committed by Patrick Niklaus
parent 875f482203
commit 17e15033e1
3 changed files with 29 additions and 4 deletions
+12 -4
View File
@@ -521,10 +521,18 @@ EdgeID Contractor::LoadEdgeExpandedGraph(
using boost::interprocess::mapped_region;
using boost::interprocess::read_only;
const file_mapping mapping{filename.c_str(), read_only};
mapped_region region{mapping, read_only};
region.advise(mapped_region::advice_sequential);
return region;
try
{
const file_mapping mapping{filename.c_str(), read_only};
mapped_region region{mapping, read_only};
region.advise(mapped_region::advice_sequential);
return region;
}
catch (const std::exception &e)
{
util::Log(logERROR) << "Error while trying to mmap " + filename + ": " + e.what();
throw;
}
};
const auto edge_based_graph_region = mmap_file(edge_based_graph_filename);