I'm analyzing memory usage of my Android app with help of Eclipse Memory Analyzer (also known as MAT). Sometimes I can find strange instances of android.graphics.Bitmap
class, utilizing big portion of heap. Problem is what I can't find source of this bitmaps, no filename, no resourceID, nothing. All information what I can find for bitmap is following:
There is a field mBuffer
with array of image pixels, I assume. But it's in some internal Android format, not PNG.
Question: how can I view image represented by this bitmap from memory dump?
I have found a way to view such bitmaps:
Bitmap
object in MAT, right-click on mBuffer
field, in the popup menu choose "Copy" -> "Save Value To File" menu item and save value of this array to some file.data
to that file.data
file and click Open buttonAt that point you should already observe preview of original image. If you didn't, you can try to change some other parameters in "Load Image from Raw Data" dialog.
NOTE: to get a width and height of image you can look at mWidth
and mHeight
fields in MAT in attributes section as shown in image in question.