问题描述
尝试使用Memory Analyzer打开HPROF文件(由Debug.dumpHprofData
创建)时,出现以下异常:
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)
我该如何解决?
推荐答案
从Android获取的hprof
文件具有android特定格式.您应该将来自Android OS的hprof
文件转换为标准hprof
格式.为此,您可以使用位于AndroidSDK/tools/hprof-conv
的hprof-conv
工具.
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
.
例如:
hprof-conv android.hprof mat.hprof
然后在内存分析器中打开mat.hprof.
And then open mat.hprof in Memory Analyzer.
hprof-conv在某些软件包中可能位于AndroidSDK/platform-tools/
下.
hprof-conv might be located under AndroidSDK/platform-tools/
in some bundles.
这篇关于打开HPROF文件时出错:IOException:未知的HPROF版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!