Memory Analyzer Tool in Android

Memory Analyzer Tool in android?

  1. Open DDMS perspective in Eclipse.
  2. Select Devices tab.
  3. Choose a process you want to make a dump for.
  4. Click Dump HPROF file button. The dump will be made and MAT window will be opened, assuming MAT is installed.
  5. Choose Leak Suspects Report in the wizard window and click Finish.

That's all. You'll se a list of possible leaks, but some of them are false-positive. I recommend you to run an activity you want to check leaks in several times and then run MAT again.

Does Android Studio has a memory analyzer tool like MAT in Eclipse?

With 1.3, they have integrated heap viewer in studio.

Android studio 1.3 preview

How to analyze memory using android studio

I'll explain it in an easy way with steps:

  1. First, you have install MAT ( download ) or use:

    brew cask install memoryanalyzer

  2. In Android Studio open Android Device Monitor or DDMS.

  3. Select your process "com.example.etc.."

  4. Click Update Heap above the process list.

  5. In the right-side panel, select the Heap tab.

  6. Click in Cause GC.

  7. Click Dump HPROF file above the process list.

  8. When we downloaded the file HPROF, we have to open the Terminal and run this command to generate the file to open it with MAT.

  9. Open terminal and run this command

./hprof-conv path/file.hprof exitPath/heap-converted.hprof

The command "hprof-conv" is in the platform-tools folder of the sdk.


  1. And ready and MAT can open and open the converted file ( heap-converted.hprof ) .

Memory Analyzer Tool - Android

In android, we can use Memory Analyser tool to capture the memory leaks(if any) in a particular code. We should generate the heap dump just before performing the operation responsible for leak and after completing the operation. Compare these 2 dumps and find which objects are taking memory and why it is not garbage collected.

In my case mentioned above, i rather than analysing the dump generated after going to 2nd activity, i tried to compare the dumps before and after the activity. I got the required results clearly.

Also, regarding MAT tool, it is good to try more than once and compare the dumps and choose a dump for analysis.

Thanks friends.

HPROF Analyzer tool not found in Android studio 3

You need to save the dump file and open it via the "capture" tab. Then the analyzer is available

Android == Memory Analysing == Eclipse memory analyzer?

When you debug your app, open DDMS in Eclipse. On the toolbar there is a heap dump button that you can use to generate a heap dump to view in Eclipse memory analyzer. This is only supported I think with the 1.6+ or 2.0+ SDK.

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.

Memory Analyzer (MAT) plugin not opening heap prof in MAT Eclipse 4.1.2 automatically

try this:

in eclipse -> windows -> preference -> android --> ddms -> HPROF Action menu

choose: open in eclipse



Related Topics



Leave a reply



Submit