Skip to content
Advertisement

Calculate Xmx setting and actual heap size from Java dump

I’ve got a heap dump file (java_dump.hprof) written by a Java 7 JVM.

Is it somehow possible to calculate the Xmx command line option as well as the actual heap size from this dump?

Advertisement

Answer

The dump is based on the size actually used but in a different format so it could be bigger.

If the dump was triggered on an OutOfMemoryError, the heap was approximated the size of all the objects dumped in total will be close to the Xmx. Note: if creating a very large object triggered the OOME, this won’t be included.

If it was triggered by a user, you only know the maximum is not smaller than the objects dumped.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement