11

HPROF Analyzer/Analyzer tasks is a great tool in android studio 2 which helps detect memory leaks. It's less time-consuming than using the eclipse MAT tool. However, I couldn't find it using the new Android Profiler in AS3.

Any help is greatly appreciated!

Rami Jemli
  • 2,550
  • 18
  • 31
  • Did you find it? I have the same issue. The new memory profiles is sooooo slow. Its just unworkable. If i dump a heap. I don't get a hprof file out of it. Official documentation is still for android studio 2 – Gillis Haasnoot Nov 15 '17 at 15:28
  • Dump heap and then open the captures tab (top left below the project and structure tabs). Double click the hprof file and voila, you get the analyzer. – Rami Jemli Nov 15 '17 at 17:28
  • If you can't find the capture file, check mark's comment below. – Rami Jemli Nov 15 '17 at 17:29
  • Yeah i found it. I did not know you had to save it as a .hprof file and still convert it command line with hprof-conv dump.hprof realhprofdump.hprof – Gillis Haasnoot Nov 16 '17 at 16:04

2 Answers2

9

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

user8837517
  • 106
  • 2
  • 8
    Interestingly I found that AS was not showing the saved capture in the project explorer window, or nothing in the captures window even after saving hprof file. I went into Preferences -> Editor -> File Types and found under Ignore files and folders the *.hprof file type. I removed this, then it appeared in Project Explorer. – Mark Nov 04 '17 at 17:55
  • 1
    In my case file was exported without extension. add ".hprof" and everything should be fine – Marriage Feb 07 '18 at 11:40
3

First save your .hprof file.

enter image description here

Then drag that into Android Studio.

Find more details here

Zeero0
  • 2,602
  • 1
  • 21
  • 36
  • The section part of your "find more details" link isn't valid any more. Better link: https://developer.android.com/studio/profile/memory-profiler#save-hprof – ajb Nov 01 '18 at 01:04
  • 2
    Android Studio 3.0.1 saves the file with nothing in it, size of the file 0kb – Alex Dec 17 '18 at 20:28