+XX:HeapDumpPath is a JVM-Option that is honored by the HeapDumpOnOutOfMemory JVM-Option.
With it we can define where HeapDumps are written to the Disk.
Why do we need this?
Well, running multiple servers we may want to have them dumped centrally on a mapped network drive specifically for logfiles or dumps. Also maybe we sized the Partition for the JVM-Process too small so that a dump will not be able to be written into it (ok, disk space is cheap, even with a raid, but often we save money at the wrong end).
But if i trigger an heapdump directly (like with jconsole) i often only write the name of the dump into it or want to have it generated. Normally those dumps will now be written into the working directory of the jvm.
To avoid this, we can use the following Code to have it honored and registered as our own MBean that we will use from now on.
„Manually Creating HeapDumps in Java honoring +XX:HeapDumpPath JVM Option“ weiterlesen