Android: Opening .hprof file In Eclipse

9.2k views Asked by At

Im trying to check for memory leaks by using a HPROF File from eclipses DDMS view.

I tried using MAT to read a .hprof saved to disk but got error:

Error opening heap dump 'com.myapp.myapp.hprof'. Check the error log for further details.
Error opening heap dump 'com.myapp.myapp.hprof'. Check the error log for further details.
Unknown HPROF Version (JAVA PROFILE 1.0.3) (java.io.IOException)
Unknown HPROF Version (JAVA PROFILE 1.0.3)

So i followed a solution in another post on StackOverflow which told me to change the preferences

Android > DDMS > HPROF Action : View In Eclipse

But that just displays the file as an unreadable text file: hprof file in eclipse

Im assuming its supposed to be easier to understand than that so what am I doing wrong?

EDIT

I read in other posts about using something called hprov-conv.exe i tried to open that, it flashed a screen then closed (even when opening as an administrator) so i dont know how to use that.

3

There are 3 answers

2
CommonsWare On BEST ANSWER

The "Open in Eclipse" option will only work if you are using the MAT Eclipse plugin. The MAT Downloads page shows the "Update Site" link, which you can add to Eclipse via Help > Install New Software > Add.

0
Aduait Pokhriyal On

You can use HPROF Converter tool provided in android sdk.

The hprof-conv tool converts the HPROF file that is generated by the Android SDK tools to a standard format so you can view the file in a profiling tool of your choice.

hprof-conv <infile> <outfile>

More at HPROF Converter

After converting file opens without any Issue.

0
sivi On
  • You can still use a separated MAT (which I figured out is the right thing to do because the guy who develop this system does it that way and he seems to know it's smarter way to separate concerns)

  • You can do that. You have to copy that file to a non temporary
    directory (desktop or something like that) and open that like you
    would a converted file.

  • You save this file and than open it in the MAT Eclipse.

  • It seems like the the DDMS save to disk saves the regular .hprof file and the other version save to file save an encoded adt version at least on my machine.

    for more information on this approach watch this video http://www.youtube.com/watch?v=_CruQY55HOk