error opening HPROF file: IOException: Unknown HPROF Version
Asked Answered
H

3

125

I am getting the following exception when trying to open HPROF file (created by Debug.dumpHprofData) with Memory Analyzer:

java.io.IOException: Unknown HPROF Version (JAVA PROFILE 1.0.3)
at org.eclipse.mat.hprof.AbstractParser.readVersion(AbstractParser.java:124)
at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:69)
at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:65)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:203)
at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:114)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:143)
at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:123)
at org.eclipse.mat.ui.snapshot.ParseHeapDumpJob.run(ParseHeapDumpJob.java:56)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)

How do I resolve this?

Hoban answered 2/6, 2011 at 18:58 Comment(1)
under windows system you might find this post helpful #14168985Condition
M
310

The hprof file you get from Android has android specific format. You should convert hprof file take from Android OS into standard hprof format. For this you can use hprof-conv tool that is located at AndroidSDK/tools/hprof-conv.

For example:

hprof-conv android.hprof mat.hprof

And then open mat.hprof in Memory Analyzer.

EDIT: hprof-conv might be located under AndroidSDK/platform-tools/ in some bundles.

Maestro answered 2/6, 2011 at 19:3 Comment(7)
@Maestro hprof-conv used to run automatically when clicking the dump button, I'm not sure which version of ADT this stopped working but its likely a bugIntromission
@smith234, It might be true for the button in DDMS. But when Debug.dumpHprofData() is used the conversion should be done manually.Maestro
I was getting a 'permission denied' error in the tools directory nevertheless. I had to chmod permissions in that directory in order for it to work.Queeniequeenly
Typo: the latest version of MAT requires that the filename extension is hprof, not hpof as in the example above.Helenahelene
I get "ERROR: failed reading input" when trying to convert. Any idea? I use Android Debug Monitor 21.1.0 to produce the heap dumpLaborious
just a heads up, my hprof-conv was under sdk\platform-tools instead in case anyone missed it under sdk/toolsScolopendrid
I followed every step, on ubuntu but still am getting error "hprof-conv command not found" can anybody help stackoverflow.com/q/29489190/1994950Nubble
B
41

If you are using Eclipse, just change the following:

  1. Open Preferences (from the Window menu)
  2. Navigate to Android->DDMS
  3. Change the HPROF action to "Open in Eclipse"
Bernardinabernardine answered 27/2, 2012 at 20:42 Comment(4)
In Windows 7 64bit, I couldn't convert using hprof-conv tool, it just didn't nothing. So tried your method and it works! I just should have to install MAT to eclipse and it now works perfectly. thanksScudder
It might be good to update to explain that the user should open Eclipse preferences first and then select Android from the left hand menu etcTakakotakakura
in Luna I needed to install MAT manually: Help-> Install New Software: download.eclipse.org/mat/1.4/update-siteMousse
In my Eclipse Mars.2 (4.5.2) (Win 10) "Open in Eclipse" is already set and MAT is installed, yet I still get the "unknown HPROF version" error. I had to convert the file with "hprof-conv".Protoxylem
M
7

hprof-conv tool location got changed.

It is now located at AndroidSDK/platform-tools/hprof-conv

Manolete answered 30/3, 2015 at 20:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.