Automatically dump heap memory when JVM OOM occurs
About 199 wordsLess than 1 minuteNovember 23, 2024
Enable Heap Dump
Add the -XX:+HeapDumpOnOutOfMemoryError
parameter to automatically generate a heap dump when an OOM error occurs. This ensures a heap snapshot is produced when memory overflows.
Set Heap Dump Path
Use the -XX:HeapDumpPath
parameter to specify the file path for the heap dump. This ensures the dump file is saved at a designated location for later analysis.
Name the Heap Dump File
Use the -XX:HeapDumpOnOutOfMemoryError
parameter to give the heap dump file a specific name. This helps differentiate between snapshots from various times or servers for easier management.