尝试使用内存分析器打开 HPROF 文件(由 Debug.dumpHprofData
创建)时出现以下异常:
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)
我该如何解决这个问题?
最佳答案
您从 Android 获得的 hprof
文件具有 android 特定格式。您应该将 Android 操作系统中的 hprof
文件转换为标准的 hprof
格式。为此,您可以使用位于 AndroidSDK/tools/hprof-conv
的 hprof-conv
工具。
例如:
hprof-conv android.hprof mat.hprof
然后在 Memory Analyzer 中打开 mat.hprof。
编辑:hprof-conv 可能位于某些包中的 AndroidSDK/platform-tools/
下。
关于android - 打开 HPROF 文件时出错 : IOException: Unknown HPROF Version,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6219049/