NonStop Server for Java 7.0 Programmer's Reference

NOTE: The XX:+HeapDumpOnOutOfMemoryError option does not work with
the low-pause collector (option XX:+UseConcMarkSweepGC).
-XX:+HeapDumpOnly
It enables heap dumps using the SIGWINCH signal (signal 12) with the help of
XX:+HeapDumpOnly option or _JAVA_HEAPDUMP_ONLY environment variable.
This interface is provided to separate the generation of thread and trace information
triggered through SIGQUIT from the heap dump information. If the
XX:+HeapDumpOnly option is specified or _JAVA_HEAPDUMP_ONLY environment
variable is set, the heap dump functionality is triggered by sending SIGWINCH to
the process. The printing of thread and trace information to STDOUT is suppressed.
The heap dump is written to a file in the following format:
java_<pid>_<date>_<time>_heapDump.hprof.txt.
The default output format is ASCII. The output format can be changed to hprof
binary format by setting _JAVA_BINARY_HEAPDUMP environment variable. This
environment variable can also be used with the XX:+HeapDump option to generate
hprof binary format with SIGQUIT signal.
Using heap dumps to monitor memory usage
By creating a series of heap dump snapshots, you can see how the number and size of objects
varies over time. It is a good idea to collect at least three snapshots. The first one serves as a
baseline. It must be taken after the application has finished initializing and has run for a short
period.
The second snapshot is taken after the residual heap size has grown significantly. You can monitor
the residual heap size using Xverbosegc and HPjmeter.
Take the last snapshot just before the heap has grown to a point where it causes problems resulting
in the application spending the majority of its time doing full GCs. If you take other snapshots,
spread them out evenly based on residual heap size throughout the running of the application.
The leak is easier to track down if the difference in size between heap dumps is large.
After collecting snapshots, view them in HPjmeter, and perform the following:
Compare the files using File>Compare.
You must be able to find out the type of objects that are accumulating in the Java heap.
Select a type of objects by using Mark to Find.
Go back and view one of the snapshots.
Go to Metric>Call Graph Tree and do a Find. You must be able to see the context of
the object retention.
TIP: When creating heap dumps, running the application with smaller heap sizes results in smaller
heap dump files. Smaller heap dump files enable HPjmeter analysis to use lesser memory.
ZapInitialHeap option
ZapInitialHeap is a HP specific option to help improve the speed of garbage collection. By
default, this option is set to false.
When this option is set to true, it forces the JVM to map all the virtual memory pages of the Java
object heap during the initialization (JVM load) phase. This action significantly reduces the number
of page faults that might occur during GC in the later stages of execution, thereby speeding up
memory access during GC.
62 Implementation specifics