Automatic Heap Dumps
You can automatically save heap dumps on OutOfMemoryError
by using the following options with the java
command: -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=../logs
Diffusion does this by default, saving the dump file in the /logs
directory.
Manual Heap Dumps
To take a heap dump for some reason other than OutOfMemoryError
, follow the procedure below:
1. Find process ID
To obtain a Java heap dump of a running VM, you first need to find out the PID (process id) of the Java VM process that is running Diffusion. On Windows, you can do this by opening Task Manager, going to the Processes tab and looking in the PID column. On Linux, you can find it by running the jps
tool from the command line. The output will include a line similar to this: 4315 Diffusion
where the number is the PID you need.
2. Run jcmd command
From a console, run the following command: jcmd <pid> GC.heap_dump heap.bin
This will save a heap dump to a file called heap.bin
.
Resources:
Java HotSpot VM Command-Line Options with more detail about -XX:HeapDumpOnOutOfMemoryError
Finding the process ID on Windows, including alternatives to using Task Manager Full documentation for jps The jcmd Utility
Comments
0 comments
Please sign in to leave a comment.