I have serious memory problems in my application [1]. To explore this, I took the heapdumps of my application in different states. I saw that some bitmap images occupy a huge amount of memory. I wrote a small tool [2] that decodes byte arrays into Windows raster files (.bmp) so that I can see raster images and compare them with the files that I have in my res/drawable
.
I found that all my files are doubled twice.
First, I checked the largest of them: a byte array buffer larger than 9 MB in heap, which was decoded as a good 1920x1280 image, while the original one was 960x640 png file.
I tried with the second largest, more than 3 MB, which was once decoded, showed a beautiful 754x1200 picture, the original size was ... guess what? Good file with a diagonal of 377x600.
What gives?
I turned on HW acceleration in my Android manifest file (although I'm not sure I really need it, I just use some basic views and actions).
I am using Android 4.0.2 on a GSM Galaxy Nexus (yakju). I get feedback from my testers that a problem is present on their 4.0.3 Nexus S, although I still could not check their heaps.
I'm trying to save memory here if Android doubles everything, it is not surprising that the application crashes quickly because the heap usage gets too high (about 64 MB in my case). Hope there is a reason and a way around.
Literature:
source share