Memory Management For
Android Apps
Who am I ?
Faculty at Aiti-Aptech
Android leader at Zoo Studio
What will I share today ?
Heap size
Garbage Collection
Bitmap management
290 MB
2GB
Heap size
Heap size Limits.
G1 : 16MB
Nexus One : 32MB
Galaxy S3 : 64MB
Heap size
Honeycomb (3.0) support option : “largetHeap” ActivityManager.getLargeMemoryClass()
Garbage Collection
Garbage Collection
Bigger heaps = longer pauses
Pre- Gingerbread Stop all application Pause time > 100ms
Gingerbread and beyond Concurrent Pause times < 5ms
Bitmap
Pre Android 2.3 Freed via recycle() Full, Stop the world GCs
Bitmap
> Android 2.3 Freed synchronously by GC Concurrent & partial GCs
GC_FOR_ALLOC freed <1K, 5% free 4961K/5176K, paused 13ms, total 13ms
GC_CONCURRENT freed 0K, 5% free 4961K/5176K, paused 8ms+0ms, total 10ms
GC_FOR_ALLOC freed 2418K, 45% free 3192K/5788K, paused 1ms, total 1ms
References
http://android-developers.blogspot.com/2011/03/memory-analysis-for-android.html.
http://kohlerm.blogspot.com/2009/02/memory-leaks-are-easy-to-find.html
http://developer.android.com/training/displaying-bitmaps/manage-memory.html