javaout-of-memoryheap-memoryheap-dumpjmap

Dumping Java Heap File on OutOfMemoryError using Jmap


I've been trying to dump the heap file when an OutOfMemoryError occurs on a given Java process using Jmap.

I have been able to dump the heap file but I want to add the HeapDumpOnOutOfMemoryError flag to Jmap but I think I'm doing something wrong. Am I doing something wrong? I've tried:

jmap -J-XX:+HeapDumpOnOutOfMemoryError -dump:live,file=/home/eduardo2/dumpfile.hprof 18763

When I run the above it just says the following -- but it doesn't wait for the OutOfMemoryError:

>> Dumping heap to /home/eduardo2/dump21file.hprof ...
>> Heap dump file created

Solution

  • You are mixing up two different things: