OutOfMemory is very common error we Middleware Consultants face and sometime to analyse the issue we need to take HEAP Dumps too.
A heap dump is a snapshot of the memory of a Java process at a certain point of time. Java or Jrockit can be parametrized to generate a heap dump automatically when an OutOfMemoryError occurs. This is also called “javacore” sometimes.
A Heap Dump should not be confused with a core dump which is a binary file generated by the operative system. It is created automatically after a JVM crash.
Steps to take Heap Dump.
a) Too configure JVMs to generate an automatic heap dump, the following parameters should be added at JVM startup (valid for Java 1.7 and higher and JRockit).
Above needs to be added in startup script so that Weblogic Server picks up the Java Options.
b) The second option would be to generate a heap dump manually. Assuming 6666 to be the PID of your Weblogic Server process
jcmd <PID> GC.heap_dump "/path/to/Myheapdump.hprof"
jrcmd <PID> hprofdump filename="/path/to/Myheapdump.hprof"
For example: jcmd 12345 GC.heap_dump "/path/to/Myheapdump.hprof"