add some static asserts to guard against memory usage regressions
This commit is contained in:
		
							parent
							
								
									0b873f590c
								
							
						
					
					
						commit
						d93b4feb99
					
				| @ -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
 | ||||
|  | ||||
| @ -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); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user