How to generate a java heap dump in JBoss/Wildfly when out of memory occurs
non-vAPP
Add the heap dump options (-XX:+HeapDumpOnOutOfMemoryError)to your standalone.conf files so that the JVM will create a heap dump for further review when an out of memory occurs.
Create a Heap Dump Automatically on OutOfMemoryError:
You can use the -XX:+HeapDumpOnOutOfMemoryError JVM option to automatically create a heap dump when an OutOfMemoryError exception is thrown.
This creates a heap dump file in the HPROF format, usually located in EAP_HOME or EAP_HOME/bin. Alternatively, you can set a custom path for the heap dump using -XX:HeapDumpPath=/path/. If you specify a file name using -XX:HeapDumpPath, for example, -XX:HeapDumpPath=/path/filename.hprof, the heap dumps will overwrite each other.