- -XX:HeapDumpPath: By default the heap dump is created in a file called java_pid<pid>.hprof in the working directory of the VM, where <pid> is the process ID. You can specify an alternative file name or directory with this option. This option is available only after JVM version 1.5 update 7 and above.
For example, -XX:HeapDumpPath=~/dumps will cause the heap dump to be generated in the ~/dumps directory.
- -XX:+HeapDumpOnOutOfMemoryError: This VM option tells the VM to generate a heap dump when OutOfMemoryError is thrown because the java heap or the permanent generation is full. A heap dump is useful in production systems where you need to diagnose an unexpected failure.