For a large-scale enterprise application, it is very common to consume bigger amount of memory on the server. If the server characteristics were chosen incorrectly, or workload increased and there is no enough memory it is common scenario to face an out of memory error, which will result in an application crash. It’s a critical scenario, which might be hard to replicate and fix. In order to help in this situation JVM comes with a bunch of helpful parameters, one of which is HeapDumpOnOutOfMemoryError. What it does is that instructs the JVM to dump heap into physical file in case of OutOfMemoryError.
The heap dump is in HPROF binary format, and so it can be analyzed using any tools that can import this format. For example, the jhat tool can be used to do rudimentary analysis of the dump. By default the heap dump is created in a file called java_pid pid .hprof in the working directory of the VM
By default it is disabled.
TODO link HeapDumpPath, OnOutOfMemoryError
If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.
Edit your Comment