问题
My jmap
command is sudo -u flume /usr/java/jdk1.8.0_60/bin/jmap -F -dump:format=b,file=heap.hprof pid
,
But eclips mat can't open the dump file,and throw an exception.
java.lang.NullPointerException at org.eclipse.mat.hprof.HprofParserHandlerImpl.resolveClassHierarchy(HprofParserHandlerImpl.java:587) at org.eclipse.mat.hprof.Pass2Parser.readInstanceDump(Pass2Parser.java:205) at org.eclipse.mat.hprof.Pass2Parser.readDumpSegments(Pass2Parser.java:159) at org.eclipse.mat.hprof.Pass2Parser.read(Pass2Parser.java:89) at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:94) at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.parse(SnapshotFactoryImpl.java:222) at org.eclipse.mat.parser.internal.SnapshotFactoryImpl.openSnapshot(SnapshotFactoryImpl.java:126) at org.eclipse.mat.snapshot.SnapshotFactory.openSnapshot(SnapshotFactory.java:145) at org.eclipse.mat.ui.snapshot.ParseHeapDumpJob.run(ParseHeapDumpJob.java:83) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Here is my environment.
java version "1.8.0_60" Java(TM) SE Runtime Environment (build 1.8.0_60-b27) Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode) Linux version 2.6.32-504.el6.x86_64
But jhat can analyze it correctly.
回答1:
It appears that this is a known issue for Java 8. See Bug 471757 and Bug 476262. Neither have fixes. As a temporary workaround, I would try Yourkit. It costs money, but it's worked well for me in the past, and at least you can get a free 2 week evaluation key that should be long enough to resolve your current issue.
来源:https://stackoverflow.com/questions/34719148/mat-cant-open-the-dump-file