Memory issues in ArcGIS Routing Sample

466
3
09-16-2011 02:27 AM
TariqMohd
New Contributor
I have integrated Routing feature in my app but its allocating too much memory and as a result my application got crash. I have just walk through "ArcGIS Routing Sample" and found the same problem with sample code as well.

In Sample Code: RoutingSampleViewController class

For execute the route task it is written

[self.routeTask solveWithParameters:self.routeTaskParams];

Background arcgis execution happened before coming into this delegate:

- (void)routeTask:(AGSRouteTask *)routeTask operation:(NSOperation *)op didSolveWithResult:(AGSRouteTaskResult *)routeTaskResult

So I have observed using xcode instruments suppose memory allocations is 15MB before starting route feature... and as soon as I start route feature, allocation going very fast and it become 40-50MB if i selected long routes.

Please help me to resolve this issue.

Thanks
0 Kudos
3 Replies
DiveshGoyal
Esri Regular Contributor
Hi, Tariq -

A couple of suggestions :

1) Do you have the returnDirections property on AGSRouteTaskParameters set to YES? If so, you can try setting the returnRouteGraphics property to NO. This is because, you're essentially getting the entire route geometry twice if both these properties are enabled. The only difference is that the entire route is broken into smaller units as part of the directions.

2) You can try generalizing the route geometry through the outputGeometryPrecision property on AGSRouteTaskParameters. By default, it is set to generalize using a distance of 5 meters, but you can increase this depending on how accurate you want the route geometry to be. The less accurate it is, the lesser vertices it will have and thus the size of the geometry will decrease. You may need to experiment to see what value works best for you without sacrificing too much accuracy and still keeping the size reasonable.
0 Kudos
TariqMohd
New Contributor
Hi,

As per your suggestion,

self.routeTaskParams.returnRouteGraphics = YES;
self.routeTaskParams.returnDirections = YES;

If I am trying to set value to NO of any of these values then I cant see route lines on Map. And allocations are also happening at the same speed. Can you please update your existing Routing Sample source code ? Because if i try to plot routes between end corners of US Map then allocation is too much... i can see with Instruments.

It would be very helpful if you can update your existing code.
Or if you can provide me updated code on tariq2305@gmail.com

--
Tariq
0 Kudos
TariqMohd
New Contributor
TEAM i am still waiting for your reply
0 Kudos