问题描述
尝试使用内存分析器打开 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)
我该如何解决这个问题?
How do I resolve this?
推荐答案
您从 Android 获得的 hprof
文件具有 android 特定格式.您应该将从 Android 操作系统中获取的 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 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!