You can get a heap dump on an out of memory error for Sun JVM (1.4.2_12 or higher and 1.5.0_07 or higher), HP-UX JVM (1.4.2_11 or higher) and SAP JVM (since 1.5.0) by setting the following JVM parameter:
-XX:+HeapDumpOnOutOfMemoryError
The heap dump is written to the work directory.
To get heap dump on demand use the following JVM parameter:
-XX:+HeapDumpOnCtrlBreak
Alternatively, other tools can be used to acquire a heap dump: