Over the past few days I have read several similar publications, but none of them specifically answered this problem. I'm starting to get the OOM problem after ~ 2 minutes of aggressive panning of the map and zooming with the hybrid map. The application also seems to hold memory after a failure, because it takes less time to reach OOM after the first failure. I reduced the code only to Activity using MapFragment and still got the same OOM. I used DDMS and MAT to try to isolate the problem, besides adding android:largeHeap="true" , which only delays OOM. Reorienting the screen is not a problem because I set android:screenOrientation="portrait" in my manifest. Any help would be appreciated.
Update 2014-08-25: Is this supposed to be fixed back in May 2013?
Update 2014-09-06: Still not successful, the only good option is to use Normal instead of Hybrid . It seems that the GC may keep up with the images.
Related posts:
Error when using the Google Maps API
Memory leak for Android API Google Maps v2
Google Maps Google API, OutOfMemoryError
MainActivity:
public class MainActivity_blank extends Activity { GoogleMap mMap; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);
LogCat:
08-26 17:15:29.302: I/dalvikvm-heap(19642): Forcing collection of SoftReferences for 67108880-byte allocation 08-26 17:15:29.372: D/dalvikvm(19642): GC_BEFORE_OOM freed 822K, 65% free 37523K/106080K, paused 78ms, total 78ms 08-26 17:15:30.582: W/dalvikvm(19642): chunk is too big to transmit (length=49579336, 48435 bytes) 08-26 17:15:31.532: E/dalvikvm-heap(19642): Out of memory on a 67108880-byte allocation. 08-26 17:15:31.532: I/dalvikvm(19642): "GLThread 14876" prio=5 tid=19 RUNNABLE 08-26 17:15:31.532: I/dalvikvm(19642): | group="main" sCount=0 dsCount=0 obj=0x42c120d8 self=0x787e8438 08-26 17:15:31.532: I/dalvikvm(19642): | sysTid=19729 nice=1 sched=0/0 cgrp=apps handle=2021558416 08-26 17:15:31.532: I/dalvikvm(19642): | state=R schedstat=( 51120733635 13119596807 80537 ) utm=1904 stm=3208 core=0 08-26 17:15:31.532: I/dalvikvm(19642): at android.graphics.Bitmap.nativeCreate(Native Method) 08-26 17:15:31.532: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:924) 08-26 17:15:31.532: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:901) 08-26 17:15:31.532: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:868) 08-26 17:15:31.532: I/dalvikvm(19642): at opl.a((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at okg.a((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at opy.a((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at opx.a((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at ojx.a((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at ojx.b((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at otq.k((null):-1) 08-26 17:15:31.532: I/dalvikvm(19642): at otq.run((null):-1) 08-26 17:15:31.542: W/System.err(19642): OutOfMemory 08-26 17:15:31.642: D/dalvikvm(19642): GC_EXPLICIT freed 4803K, 64% free 38238K/106080K, paused 6ms+11ms, total 102ms 08-26 17:15:32.822: W/dalvikvm(19642): chunk is too big to transmit (length=49444016, 48303 bytes) 08-26 17:15:33.682: D/dalvikvm(19642): GC_FOR_ALLOC freed 3728K, 66% free 36916K/106080K, paused 65ms, total 65ms 08-26 17:15:34.752: W/dalvikvm(19642): chunk is too big to transmit (length=49398928, 48259 bytes) 08-26 17:15:35.462: I/dalvikvm-heap(19642): Forcing collection of SoftReferences for 67108880-byte allocation 08-26 17:15:35.512: D/dalvikvm(19642): GC_BEFORE_OOM freed 413K, 66% free 36502K/106080K, paused 52ms, total 52ms 08-26 17:15:36.742: W/dalvikvm(19642): chunk is too big to transmit (length=49398928, 48259 bytes) 08-26 17:15:37.282: E/dalvikvm-heap(19642): Out of memory on a 67108880-byte allocation. 08-26 17:15:37.282: I/dalvikvm(19642): "GLThread 14876" prio=5 tid=19 RUNNABLE 08-26 17:15:37.282: I/dalvikvm(19642): | group="main" sCount=0 dsCount=0 obj=0x42c120d8 self=0x787e8438 08-26 17:15:37.282: I/dalvikvm(19642): | sysTid=19729 nice=1 sched=0/0 cgrp=apps handle=2021558416 08-26 17:15:37.282: I/dalvikvm(19642): | state=R schedstat=( 54770836691 14106993077 84458 ) utm=1996 stm=3481 core=0 08-26 17:15:37.282: I/dalvikvm(19642): at android.graphics.Bitmap.nativeCreate(Native Method) 08-26 17:15:37.282: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:924) 08-26 17:15:37.282: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:901) 08-26 17:15:37.282: I/dalvikvm(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:868) 08-26 17:15:37.282: I/dalvikvm(19642): at opl.a((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at okg.a((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at opy.a((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at opx.a((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at ojx.a((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at ojx.b((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at otq.k((null):-1) 08-26 17:15:37.282: I/dalvikvm(19642): at otq.run((null):-1) 08-26 17:15:37.432: W/dalvikvm(19642): threadid=19: thread exiting with uncaught exception (group=0x4178cda0) 08-26 17:15:37.442: E/AndroidRuntime(19642): FATAL EXCEPTION: GLThread 14876 08-26 17:15:37.442: E/AndroidRuntime(19642): Process: com.example.maptest, PID: 19642 08-26 17:15:37.442: E/AndroidRuntime(19642): java.lang.OutOfMemoryError 08-26 17:15:37.442: E/AndroidRuntime(19642): at android.graphics.Bitmap.nativeCreate(Native Method) 08-26 17:15:37.442: E/AndroidRuntime(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:924) 08-26 17:15:37.442: E/AndroidRuntime(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:901) 08-26 17:15:37.442: E/AndroidRuntime(19642): at android.graphics.Bitmap.createBitmap(Bitmap.java:868) 08-26 17:15:37.442: E/AndroidRuntime(19642): at opl.a(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at okg.a(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at opy.a(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at opx.a(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at ojx.a(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at ojx.b(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at otq.k(Unknown Source) 08-26 17:15:37.442: E/AndroidRuntime(19642): at otq.run(Unknown Source) 08-26 17:15:37.522: D/AbsListView(19642): unregisterIRListener() is called 08-26 17:15:38.092: D/AbsListView(19642): onDetachedFromWindow 08-26 17:15:38.092: D/AbsListView(19642): unregisterIRListener() is called 08-26 17:15:38.102: D/AbsListView(19642): onVisibilityChanged() is called, visibility : 8 08-26 17:15:38.102: D/AbsListView(19642): unregisterIRListener() is called