Heap Dump On Out of Memory Error
The parameter
-XX:+HeapDumpOnOutOfMemoryError
can be set to enable heap dump when the
JVM runs out of memory.
You have set this parameter in the
BW_JAVA_OPTS
environment variable.
For Example, BW_JAVA_OPTS="-Xmx1024M -Xms1024M -XX:+HeapDumpOnOutOfMemoryError
Once JVM throws an OOM exception, heap dump snapshots get generated and it gets stored within the container. Please follow the below steps to copy the heap dump snapshot from the container to your local machine:
- Connect to the container
docker exec -it <containerID> bash
- Copy the snapshot from a container to the local machine
docker cp <containerId>:/filepath/within/container/host/path/target
By default the heap dump snapshot gets stored in the root location with the name
java_pid1.hprof
.