Recycle bitmaps when not in use. After honeycomb bitmaps stay on heap.
bitmaps.recycle();
http://android-developers.blogspot.de/2009/01/avoiding-memory-leaks.html.
The link above has a topic on how to avoid memory leaks.
Also if you have high resolution image , you should scale down. See the topic under Load a Scaled Down Version into Memory.
http://developer.android.com/training/displaying-bitmaps/load-bitmap.html
Suppose you navigate form actiivty A to B. In onResume() load bitmaps. In onPause() recycle bitmaps. Do this for every activity where you load bitmaps.
You can use MAT Analyzer as shwon inthe video below to analyze and fix memeory leaks
http://www.youtube.com/watch?v=_CruQY55HOk
You could use android:largeHeap in manifest under application tag.
Warning : As the heap size increases the GC kicks in more frequently and more frequently app pauses. So just because you require a bigger heap you should not use this. You can see the video above and the guy warns about the same.
android:largeHeap
Whether your application's processes should be created with a large Dalvik heap. This applies to all processes created for the application. It only applies to the first application loaded into a process; if you're using a shared user ID to allow multiple applications to use a process, they all must use this option consistently or they will have unpredictable results.
Most apps should not need this and should instead focus on reducing their overall memory usage for improved performance. Enabling this also does not guarantee a fixed increase in available memory, because some devices are constrained by their total available memory.
To query the available memory size at runtime, use the methods getMemoryClass() or getLargeMemoryClass().
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…