Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy are all my bitmaps upsampled 200%?
    text
    copied!<p>I'm having severe memory issues in my application [1]. In order to investigate this, I took heapdumps of my app at different states. I saw that some bitmaps were taking huge amounts of memory. I wrote a small tool [2] that decodes the byte arrays to Windows bitmap files (.bmp), so that I can <em>see</em> the bitmaps and compare them to the files I have in my <code>res/drawable</code> folder.</p> <p>What I discovered is that all my files are upsampled twice.<br> I first checked with the biggest one had: a byte array buffer of more than 9MB in the heap, which was decoded to be a nice 1920x1280 picture, while the original one was a 960x640 png file.<br> I tried with the second biggest, over 3MB, which once decoded showed a nice 754x1200 picture, the original size was... guess what? A nice 377x600 jpg file.</p> <p>What gives?</p> <p>I have enabled HW acceleration in my Android Manifest file (though I'm not sure I really need it, I'm just using some basic views and activities).<br> I'm running stock Android 4.0.2 on a GSM Galaxy Nexus (yakju). I'm receiving feedback from my testers that the issue is present on their 4.0.3 Nexus S, though I couldn't check their heap dumps yet.</p> <p>I'm trying to save memory here, if Android doubles everything, no wonder the app crashes quickly because the heap usage gets too high (around 64MB in my case). I hope there's a reason and a way around it.</p> <p>References:</p> <ol> <li><a href="https://stackoverflow.com/questions/9536521/outofmemoryerror-when-loading-activities">OutOfMemoryError when loading activities</a></li> <li><a href="https://stackoverflow.com/questions/9611592/how-to-actually-see-a-bitmap-taken-from-an-android-heap-dump">How to actually see a Bitmap taken from an Android heap dump</a></li> </ol>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload