New Cache for Better Memory Performance
Hanging around and reading Android articles, and suddenly I want to check out new information on Android Training Page.
As a developer having lots of interest in Android Performance & Optimization, I check this section first: Cache with Bitmaps.
Got a note from the page:
Note: In the past, a popular memory cache implementation was a
WeakReference bitmap cache, however this is not recommended. Starting from Android 2.3 (API Level 9) the garbage collector is more aggressive with collecting soft/weak references which makes them fairly ineffective. In addition, prior to Android 3.0 (API Level 11), the backing data of a bitmap was stored in native memory which is not released in a predictable manner, potentially causing an application to briefly exceed its memory limits and crash.
Just like something light up in my head, this explains why sometimes some of my apps crash in memory limitation strangely before.
So if you got any problem with bitmap memory, this could be a hint to your optimizing solution for your Android apps.