add some static asserts to guard against memory usage regressions

This commit is contained in:
Dennis Luxen 2014-05-22 12:41:25 +02:00
parent 0b873f590c
commit d93b4feb99
2 changed files with 6 additions and 0 deletions

View File

@ -49,6 +49,7 @@ typedef DynamicGraph<NodeBasedEdgeData> NodeBasedDynamicGraph;
inline std::shared_ptr<NodeBasedDynamicGraph>
NodeBasedDynamicGraphFromImportEdges(int number_of_nodes, std::vector<ImportEdge> &input_edge_list)
{
static_assert(sizeof(NodeBasedEdgeData) == 16, "changing node based edge data size changes memory consumption");
std::sort(input_edge_list.begin(), input_edge_list.end());
// TODO: remove duplicate edges

View File

@ -252,6 +252,8 @@ int main(int argc, char *argv[])
speed_profile.has_turn_penalty_function = lua_function_exists(lua_state, "turn_function");
static_assert(sizeof(ImportEdge) == 20,
"changing ImportEdge type has influence on memory consumption!");
std::vector<ImportEdge> edge_list;
NodeID number_of_node_based_nodes =
readBinaryOSRMGraphFromStream(in,
@ -303,6 +305,9 @@ int main(int argc, char *argv[])
unsigned number_of_edge_based_nodes = edge_based_graph_factor->GetNumberOfEdgeBasedNodes();
BOOST_ASSERT(number_of_edge_based_nodes != std::numeric_limits<unsigned>::max());
DeallocatingVector<EdgeBasedEdge> edgeBasedEdgeList;
static_assert(sizeof(EdgeBasedEdge) == 16,
"changing ImportEdge type has influence on memory consumption!");
edge_based_graph_factor->GetEdgeBasedEdges(edgeBasedEdgeList);
std::vector<EdgeBasedNode> node_based_edge_list;
edge_based_graph_factor->GetEdgeBasedNodes(node_based_edge_list);