Search This Blog

Wednesday, December 16, 2009

How to generate Java heap dump in WebSphere?

􀂃 IBM Java Heap dump can be generated in either of two ways
􀀗Explicit generation
􀀗Java Virtual Machine triggered generation
􀂃 When the Java heap is exhausted, Java Virtual Machine triggered generation is enabled by default.
􀂃 To enable signal-based Java Heap dumps, the
IBM_HEAPDUMP=TRUE environmental variable or the appropriate
JAVA_DUMP_OPTS must be set.
Explicit generation
􀂃 IBM Java Heap dump can be explicitly generated in either of the
following ways
􀀗By sending a signal to the JVM from the operating system
􀀗By using the HeapDump() method inside Java code that is being executed
􀂃 For Linux and AIX, send the JVM the signal SIGQUIT (kill -3, or CTRL+\ in the console window).
􀂃 For Windows, generate a SIGINT (press the Ctrl+Break keys
simultaneously).


Java Virtual Machine triggered generation
􀂃 The following events automatically trigger the JVM to produce a Java Heap dump
􀀗A fatal native exception occurs in the JVM (not a Java Exception)
􀀗An OutOfMemoryError or heap exhaustion condition occurs (optional)
􀂃 If Java Heap dumps are enabled, they are normally produced immediately before a thread dump. They are produced also if the JVM terminates unexpectedly (a crash).

Location of IBM Java Heap dump
􀂃 The JVM checks each of the following locations for existence and write-permission, then stores the Heap dump in the first one that is available.
􀀗The location that is specified by the IBM_HEAPDUMPDIR environment variable, if set
􀀗The current working directory of the JVM processes
􀀗The location that is specified by the TMPDIR environment variable, if set
􀀗The /tmp directory (X:\tmp for Windows, where X is the current working drive)
􀂃 Note that enough free disk space must be available for the Heap dump file to be written correctly.

No comments:

Post a Comment