MAT (Eclipse Memory Analyzer) - 如何从内存转储中查看位图 [英] MAT (Eclipse Memory Analyzer) - how to view bitmaps from memory dump
问题描述
我正在
Bitmap
对象,右键单击 mBuffer
字段,在弹出菜单中选择 Copy" ->将值保存到文件" 菜单项并将此数组的值保存到某个文件中.data
.data
文件并点击 Openem> 按钮此时您应该已经观察到原始图像的预览.如果没有,您可以尝试在从原始数据加载图像" 对话框中更改一些其他参数.
注意:要获得图像的宽度和高度,您可以查看属性部分中 MAT 中的 mWidth
和 mHeight
字段,如相关图像所示.
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:
- First, you need to download and install GIMP
- Next, find your
Bitmap
object in MAT, right-click onmBuffer
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.
这篇关于MAT (Eclipse Memory Analyzer) - 如何从内存转储中查看位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!