Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15123] Android : "Out of Memory" issue in ti.map when getting directions between far places after 2-3 times

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionInvalid
Resolution Date2013-10-28T19:49:05.000+0000
Affected Version/sRelease 3.1.2
Fix Version/s2013 Sprint 22, 2013 Sprint 22 API
ComponentsAndroid
Labelsandroid, crash, ti.map
ReporterMeenakshi Pathak
AssigneeHieu Pham
Created2013-09-12T10:31:43.000+0000
Updated2017-03-03T22:00:21.000+0000

Description

We get "Out of Memory" issue in ti.map when getting directions between far places after 2-3 times. Here are the error logs:
09-12 15:36:02.483: D/libgps(490): proxy_gps_sv_status_cb()
09-12 15:36:02.723: I/dalvikvm-heap(29487): Clamp target GC heap from 71.991MB to 64.000MB
09-12 15:36:02.723: D/dalvikvm(29487): GC_BEFORE_OOM freed <1K, 1% free 65382K/65536K, paused 371ms, total 371ms
09-12 15:36:02.723: E/dalvikvm-heap(29487): Out of memory on a 80-byte allocation.
09-12 15:36:02.723: I/dalvikvm(29487): Can't dump thread 1: threadObj not set
09-12 15:36:02.723: W/dalvikvm(29487): Exception thrown (Ljava/lang/OutOfMemoryError;) while throwing internal exception (Ljava/lang/OutOfMemoryError;)
09-12 15:36:03.073: I/dalvikvm-heap(29487): Clamp target GC heap from 71.991MB to 64.000MB
09-12 15:36:03.073: D/dalvikvm(29487): GC_FOR_ALLOC freed <1K, 1% free 65382K/65536K, paused 347ms, total 347ms
09-12 15:36:03.423: I/dalvikvm-heap(29487): Clamp target GC heap from 71.991MB to 64.000MB
09-12 15:36:03.423: D/dalvikvm(29487): GC_FOR_ALLOC freed 0K, 1% free 65382K/65536K, paused 352ms, total 352ms
09-12 15:36:03.423: I/dalvikvm-heap(29487): Forcing collection of SoftReferences for 36-byte allocation
*Steps to reproduce* : 1. Import the attached project in Titanium Studio. 2. Run and Launch it in Nexus 7. 3. Two textfields would be shown. Enter 'Danbury' and 'LosAngeles' in those textfields. 4. Click on 'Get Directions' button.A map with the appropriate route would be shown. 5. Repeat step 4 approx 2-3 times. Application crashed due to memory issue. *Note:* If the same steps followed to get the directions between nearer places, the crash did not happen.

Attachments

FileDateSize
SampleMapV2-2.zip2013-09-12T10:31:43.000+00002175580

Comments

  1. Betty Tran 2013-10-17

    Any update on this issue?
  2. Hieu Pham 2013-10-28

    The problem here is that the sample code keep adding routes but never remove them. The distance between 'Danbury' and 'Los Angeles' results in a route that contain 75k+ points of latitude and longitude. This is 35mb+ of memory PER ROUTE. To prevent this, before adding new routes, one simply need to: 1. Remove the old route from the map. 2. Remove the 'points' property of the route (We need to do this because V8 GC is slow, and we know in this case that 'points' contain well over 75k objects. This is an aggressive approach, and will give us significant memory back while waiting for V8 to clean up the entire proxy.) 3. Set the RouteProxy to null (This will cause V8 to clean up the proxy some time later) Note that if you only do step 1 and 3, you'll still get an Out of Memory error on long distance routes.
       if (route != null) {
           mapView.removeRoute(route);
           route.points = {};
           route = null;
       }
       
  3. Hieu Pham 2013-10-28

    Closing issue.
  4. Lee Morris 2017-03-03

    Closing as invalid.

JSON Source