MAT (Eclipse Memory Analyzer) – how to view bitmaps from memory dump

I have found a way to view such bitmaps:

  • First, you need to download and install GIMP
  • Next, find your 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
  • give extension .data to that file
  • launch GIMP, choose “File” -> “Open”, select your .data file and click Open button
  • “Load Image from Raw Data” dialog will appear. Here you need to set correct parameters for your bitmap
  • first, choose “Image type” as “RGB Alpha” (most Android resources have this image type, but you may need to experiment with other image types)
  • second, set correct Width and Height for your bitmap (correct dimensions can be found in the memory dump)

At 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.

Leave a Comment