Note that there are some explanatory texts on larger screens.

plurals
  1. POStrange Bitmap using 1 Mb of Heap
    text
    copied!<p>Out of curiosity, I just recently tested my Android App for Memory Leaks, using the <strong>Eclipse Memory Analyzer.</strong></p> <p>I came across a strange Bitmap with the size of <strong>512 x 512 pixels using up about 1 Megabyte</strong> of my devices heap memory.</p> <p><img src="https://i.stack.imgur.com/WSRNa.png" alt="enter image description here"></p> <p>I checked my drawables folder and could not find a bitmap of that size (512 x 512).</p> <p>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: </p> <p><strong><a href="https://stackoverflow.com/questions/12709603/mat-eclipse-memory-analyzer-how-to-view-bitmaps-from-memory-dump/12709604#12709604">MAT (Eclipse Memory Analyzer) - how to view bitmaps from memory dump</a></strong></p> <p>I followed the tutorial and with the help of GIMP, I extracted the following Image:</p> <p><img src="https://i.stack.imgur.com/Ea6uI.png" alt="enter image description here"></p> <p>So my questions are:</p> <ul> <li>What is that?</li> <li>What is it doing in my applications heap?</li> <li>How do I get rid of it?</li> <li>Does anyone else have the same bitmap in his heap?</li> </ul> <p>Notes:</p> <ul> <li>In my drawables folder is no Bitmap looking like that</li> <li>The largest Bitmap my app uses is 140 x 140 pixels</li> <li>I have a feeling that this Bitmap somehow comes from the system</li> <li>The Bitmap is in heap right after app start - without any user interaction</li> <li>I am debugging on a HTC One S, Android 4.1 Cyanogen Mod (Screen 540 x 960)</li> <li>I am not using external Libraries</li> </ul> <p><strong>Update</strong>: </p> <p>With the help of <a href="https://stackoverflow.com/users/690952/selvin">Selvin's</a> suggestion and my personal felling that this could be a System-issue, I tested two other apps of mine.</p> <blockquote> <p><strong>Both of the apps I tested also showed the same Bitmap in the Memory Analyzer with exactly the same amount of bytes consumed:</strong></p> </blockquote> <p><img src="https://i.stack.imgur.com/Aazck.png" alt="enter image description here"></p> <p>Furthermore, I was able to find out that:</p> <blockquote> <p><strong>The source of the Bitmap is always associated with the LAUNCHER Activity of the app.</strong></p> </blockquote> <p>So what to do about that? Is there a way to get rid of it?</p> <p>Since I do memory-intensive operations in my app, I'd like to have as much heap available as possible.</p>
 

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