Home  >  Article  >  Java  >  Where does the heap dump get saved when using the -XX: HeapDumpOnOutOfMemoryError parameter?

Where does the heap dump get saved when using the -XX: HeapDumpOnOutOfMemoryError parameter?

Susan Sarandon
Susan SarandonOriginal
2024-11-12 14:10:02303browse

Where does the heap dump get saved when using the -XX: HeapDumpOnOutOfMemoryError parameter?

Heap Dump Location with HeapDumpOnOutOfMemoryError Parameter

When the -XX: HeapDumpOnOutOfMemoryError parameter is added to JBoss start-up options, it triggers the creation of a heap dump in the event of an out-of-memory error. To understand where this data is dumped:

Default Location:

By default, the heap dump is generated in a file named java_.hprof in the working directory of the JVM. For instance, if JBoss is running on server servername with process ID 12345, the heap dump will be located at /server/path/to/jboss/java_12345.hprof.

Custom Location:

You can specify an alternative location for the heap dump using the -XX:HeapDumpPath= option. By setting this option to a directory, such as -XX:HeapDumpPath=/disk2/dumps, you can ensure that the heap dump is saved in the specified directory.

Console Output:

The heap dump is not directly printed to the console. Instead, it is written to the specified file.

Accessing the Dump when Not Logged in:

If you're not logged into the server through the console, you can access the dump file by connecting to the server using SSH or another remote connection tool and navigating to the directory where it's located. The java_.hprof file can then be downloaded or copied to a convenient location for analysis.

The above is the detailed content of Where does the heap dump get saved when using the -XX: HeapDumpOnOutOfMemoryError parameter?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn