<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="Helvetica, Arial, sans-serif">Hi there.<br>
<br>
I've currently implemented some code based upon "simpleclient.cpp"
which is very basic. However, when running through a loop to
generate a number of routes, the memory decreases with each pass
resulting in swap file eventually being brought into the equation.
Once that happens, everything slows down!<br>
<br>
The basic bones of my code is shown below:<br>
<br>
// Set up the parameters required.<br>
RouteParameters route_parameters;<br>
route_parameters.zoom_level = 18; // no
generalization<br>
route_parameters.print_instructions = false; //
turn by turn instructions<br>
route_parameters.alternate_route = false; //
get an alternate route, too<br>
route_parameters.geometry = false; //
retrieve geometry of route<br>
route_parameters.compression = false; //
polyline encoding<br>
route_parameters.check_sum = -1; // see
wiki<br>
route_parameters.service = "viaroute"; //
that's routing<br>
route_parameters.output_format = "json";<br>
route_parameters.jsonp_parameter = ""; // set for
jsonp wrapping<br>
<br>
// Start the outer loop.<br>
for(int oLoop = 0; oLoop < 10000; oLoop++)<br>
{<br>
// Start the inner loop.<br>
for(int iLoop = 0; iLoop < 10000;
iLoop++)<br>
{<br>
// Clear down the route
parameters.<br>
route_parameters.coordinates.clear();<br>
<br>
// Start_coordinate<br>
route_parameters.coordinates.emplace_back(latlonPC[oLoop][0] *
COORDINATE_PRECISION, latlonPC[oLoop][1] * COORDINATE_PRECISION);<br>
<br>
// Target_coordinate<br>
route_parameters.coordinates.emplace_back(latlonPC[iLoop][0] *
COORDINATE_PRECISION, latlonPC[iLoop][1] * COORDINATE_PRECISION);<br>
<br>
// Run the required query.<br>
routing_machine.RunQuery(route_parameters, json_result);<br>
}<br>
<br>
}<br>
<br>
Not a lot to it, therefore I'm wondering if the memory leak is in
the RunQuery function and if so, how can I minimise the issue.<br>
<br>
Kind Regards<br>
James<br>
</font>
</body>
</html>