How to analyze memory using android studio

I agree with above answer except below steps

  1. Click Update Heap above the process list.

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

  3. Click in Cause GC.

They are not necessary.Just select your app/process in DDMS, and click to dump HPROF profile option. After that, follow the steps exactly as above.


Android Monitor -> Monitors (beside logcat) -> Memory -> dump java heap

enter image description here


There is another way to see allocations:

Start and stop allocation tracking

See the result


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