Out of curiosity, I just recently tested my Android App for Memory Leaks, using the Eclipse Memory Analyzer.
I came across a strange Bitmap with the size of 512 x 512 pixels using up about 1 Megabyte of my devices heap memory.
I checked my drawables folder and could not find a bitmap of that size (512 x 512).
I started googling and came across this question, where a user explains how to get the actual Image behind a "memory leak" reference in the Memory Analyzer:
MAT (Eclipse Memory Analyzer) - how to view bitmaps from memory dump
I followed the tutorial and with the help of GIMP, I extracted the following Image:
So my questions are:
- What is that?
- What is it doing in my applications heap?
- How do I get rid of it?
- Does anyone else have the same bitmap in his heap?
Notes:
- In my drawables folder is no Bitmap looking like that
- The largest Bitmap my app uses is 140 x 140 pixels
- I have a feeling that this Bitmap somehow comes from the system
- The Bitmap is in heap right after app start - without any user interaction
- I am debugging on a HTC One S, Android 4.1 Cyanogen Mod (Screen 540 x 960)
- I am not using external Libraries
Update:
With the help of Selvin's suggestion and my personal felling that this could be a System-issue, I tested two other apps of mine.
Both of the apps I tested also showed the same Bitmap in the Memory Analyzer with exactly the same amount of bytes consumed:
Furthermore, I was able to find out that:
The source of the Bitmap is always associated with the LAUNCHER Activity of the app.
So what to do about that? Is there a way to get rid of it?
Since I do memory-intensive operations in my app, I'd like to have as much heap available as possible.