Eclipse Memory Analyzer – Java heap space Error when Opening an hprof

Hello Everyone,

Interesting thing today; so in my adventures in running a diagnostic for why Java crashed; I got… a Java Crash on my computer when trying to open the crash dump!  Okay not really but still interesting.

To analyze a hprof crash for why Java crashes; you can use a tool such as the Eclipse Memory Analyzer.  This Open Source Project is a great tool and item to start with for analyzing crash dumps

https://www.eclipse.org/mat/

 

Unfortunately after getting the program and opening the crash file which I was hoping to analyze my computer encountered the error:

2017-10-17_0928.png

'Parsing heap dump from 'C:\Users\stenbm2\Downloads\java_pid17404.hprof" has encountered a problem.

An internal error occurred during: "Parsing heap dump from 'C:\Users\stenbm2\Downloads\java_pid17404.hprof'".

This most certainly cannot be!  But we can always find more errors; so let’s “follow the logs”!

2017-10-17_0938.png

And we then find the errors:

2017-10-17_0939.png

eclipse.buildId=unknowneclipse.buildId=unknownjava.version=1.8.0_121java.vendor=Oracle CorporationBootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_USCommand-line arguments:  -os win32 -ws win32 -arch x86_64
org.eclipse.core.jobsErrorTue Oct 17 09:28:00 EDT 2017An internal error occurred during: "Parsing heap dump from 'C:\Users\stenbm2\Downloads\java_pid17404.hprof'".
java.lang.OutOfMemoryError: Java heap space at org.eclipse.mat.parser.index.IndexWriter.copyOf(IndexWriter.java:2013) at org.eclipse.mat.parser.index.IndexWriter$Identifier.add(IndexWriter.java:93) at org.eclipse.mat.hprof.HprofParserHandlerImpl.reportInstance(HprofParserHandlerImpl.java:588) at org.eclipse.mat.hprof.Pass1Parser.readInstanceDump(Pass1Parser.java:546) at org.eclipse.mat.hprof.Pass1Parser.readDumpSegments(Pass1Parser.java:360) at org.eclipse.mat.hprof.Pass1Parser.read(Pass1Parser.java:175) at org.eclipse.mat.hprof.HprofIndexBuilder.fill(HprofIndexBuilder.java:80) 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)

2017-10-17_0940.png

eclipse.buildId=unknown
java.version=1.8.0_121
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments: -os win32 -ws win32 -arch x86_64

org.eclipse.mat.ui
Info
Tue Oct 17 09:27:44 EDT 2017
Detected compressed references, because with uncompressed 64-bit references the array at 0x7801192b8 would overlap the array at 0x780117210

 

And from the first error the primary code: java.lang.OutOfMemoryError: Java heap space

Egads!  So thus the program to analyze Java Heap Crashes; crashed due to a Java Heap Space Error.

Well for Java Heap Space errors this can be corrected by checking the configuration for the impacted program/system.  In this case, your installation folder should have the MemoryAnalyzer.ini file for the Java configuration.

2017-10-17_1346.png

From there; I was able to find the below information:

-startup
plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417
-vmargs
-Xmx1024m

 

So to start; we can find the above has the xmx configuration (one of the more popular configuration references for Java); which is for the MaxHeapSize for Java.  In this case the -Xmx1024m indicates that the system allocates approximately 1 GB of Memory for the Maximum Heap Size.  Additionally:

-Xms

-> This is for the Initial Heap Size.  This would be initial value used and in general case is the amount that will usually grow from this size.

-Xmx

-> This is for the Maximum Heap Size that is allowed.  If insufficient; Java can crash with the OutOfMemoryError we saw earlier.

While this is a tricky topic; it isn’t advisable to just increase the Java Heap Value on systems such as production without understanding the cause.  In this case, it’s on my personal laptop and the HPROF file I was trying to reach was approximately 3.9 GB so I increased the value to 2 GB in the ini file and then relaunched (from 1024 to 2048m).  However, your results may vary -> as my laptop had 8 GB of RAM.

To Do List -> More advanced topics on Java and memory allocation as this can be explained in greater detail to help confirm troubleshooting/reviews for possible/probable causes of crashes/unstable memory handling and what can be done to correct the crash.

http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.mat.ui.help%2Ftasks%2Fconfigure_mat.html

Advertisements

Author: yetanothercharacter

Technical Support Nerd (it's the glasses)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s