I have to create heapdumps, which works nice with jmap. My problem is, that jmap takes very long to create the heapdump file. Especially when the heap is getting bigger (> 1GB) it is taking too long.
One situation as example:
When the server gets into trouble with the heapspace, I want to restart it automatically and create a heapdump before the restart. This works, but takes too long to write the heapdump. This way the server is down for too long. The heapdump creation takes longer than one hour.
I know about
-XX:+HeapDumpOnOutOfMemoryError, but most of the time I can find the memory problem before the exception is thrown by the jvm.
Is there an alternative to jmap which writes the heapdumps faster?
A special solution for the example above would also be appreciated.
This question is a mix between programming and system-administration, but I think I'm at the right place here.