We're currently re-writing the API to make user's life easier :) I would love if you could test the "rewrite/new-api" branch and the adapted example code > https://github.com/Project-OSRM/osrm-backend/blob/rewrite/new-api/example/example.cpp and report back if you can reproduce memory issues with this.
(Disclaimer: the route service in this branch should work without problems, but it's still all in flux at this point in time) On Mon, Feb 29, 2016 at 7:10 AM, Patrick Niklaus < patrick.nikl...@student.kit.edu> wrote: > Hey James, > which version of OSRM are you running on? > > I would move the json_result object to the scope of the inner loop. It > is expected to empty when the function is called - might be there is a > vector filling up in there. > > Cheers, > Patrick > > On Sun, Feb 28, 2016 at 9:44 PM, James Grant <ja...@grantzone.net> wrote: > > Hi there. > > > > 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! > > > > The basic bones of my code is shown below: > > > > // Set up the parameters required. > > RouteParameters route_parameters; > > route_parameters.zoom_level = 18; // no > > generalization > > route_parameters.print_instructions = false; // turn by > turn > > instructions > > route_parameters.alternate_route = false; // get an > > alternate route, too > > route_parameters.geometry = false; // retrieve > > geometry of route > > route_parameters.compression = false; // polyline > > encoding > > route_parameters.check_sum = -1; // see wiki > > route_parameters.service = "viaroute"; // that's > > routing > > route_parameters.output_format = "json"; > > route_parameters.jsonp_parameter = ""; // set for jsonp > > wrapping > > > > // Start the outer loop. > > for(int oLoop = 0; oLoop < 10000; oLoop++) > > { > > // Start the inner loop. > > for(int iLoop = 0; iLoop < 10000; iLoop++) > > { > > // Clear down the route parameters. > > route_parameters.coordinates.clear(); > > > > // Start_coordinate > > > > route_parameters.coordinates.emplace_back(latlonPC[oLoop][0] * > > COORDINATE_PRECISION, latlonPC[oLoop][1] * COORDINATE_PRECISION); > > > > // Target_coordinate > > > > route_parameters.coordinates.emplace_back(latlonPC[iLoop][0] * > > COORDINATE_PRECISION, latlonPC[iLoop][1] * COORDINATE_PRECISION); > > > > // Run the required query. > > > routing_machine.RunQuery(route_parameters, > > json_result); > > } > > > > } > > > > 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. > > > > Kind Regards > > James > > > > _______________________________________________ > > OSRM-talk mailing list > > OSRM-talk@openstreetmap.org > > https://lists.openstreetmap.org/listinfo/osrm-talk > > > > _______________________________________________ > OSRM-talk mailing list > OSRM-talk@openstreetmap.org > https://lists.openstreetmap.org/listinfo/osrm-talk >
_______________________________________________ OSRM-talk mailing list OSRM-talk@openstreetmap.org https://lists.openstreetmap.org/listinfo/osrm-talk