NonStop Server for Java 7.0 Programmer's Reference

round-robin method. This allows GC data to be archived easily and thus helps to limit the amount
of disk space consumed by the GC log files. Log rotation is also supported when using
zero-preparation -Xverbosegc.
To enable log rotation, use the following option along with -Xverbosegc, -Xloggc, or
zero-preparation verbosegc:
-XX:GCLogLimits=M,N
where,
M is a non-negative integer that specifies the number of rotating GC log records
per file. A value of 0 specifies unlimited number of GC log records per file.
NOTE: Each GC log record corresponds to a GC event.
N is a non-negative integer that specifies the maximum number of rotating GC log
files. A value of 0 specifies unlimited number of files.
You must use both M and N when you use the -XX:GCLogLimits=M,N option. If this option is
not specified, the default behavior is to write a single GC log file with unlimited size.
When rotation is in effect, a sequence number is appended to the GC filename (0 through N-1).
For example, filename.0, filename.1, and filename.2.
With log rotation, when the specified maximum number of files (N) is reached, logging cycles
back to the first file in the sequence (filename.0), thereby overwriting the old GC data with
new data. If the maximum number of files (N) is never reached, then no log rotation occurs.
Example
To rotate between two log files, each with a maximum of 100,000 GC records, use the following
command:
-XX:GCLogLimits=100000,2
To maintain an unlimited number of smaller files, each with a maximum of 1,000 GC records, use
the following command:
-XX:GCLogLimits=1000,0
XX:+HeapDump and _JAVA_HEAPDUMP environment variable
The -XX:+HeapDump option can be used to examine memory allocation in a running Java
application by taking snapshots of the heap over time.
Another way to get heap dumps is to use the _JAVA_HEAPDUMP environment variable; setting this
environment variable enables you to take memory snapshots without making any modifications to
the Java command-line. To enable this functionality, either use the command-line option or set the
environment variable before starting the Java application.
For example, export _JAVA_HEAPDUMP=1
With the -XX:+HeapDump option enabled, each time the process is sent a SIGQUIT signal, the
JVM produces a snapshot of the Java heap in hprof ASCII format:
java_<pid>_<date>_<time>_heapDump.hprof.txt.
If you set the _JAVA_HEAPDUMP_ONLY option, heap dumps are triggered by SIGWINCH instead
of SIGQUIT. Only the heap dump is produced; that is, the thread and trace dump of the application
to STDOUT is suppressed. Setting the _JAVA_BINARY_HEAPDUMP environment variable along
with _JAVA_HEAPDUMP_ONLY produces a binary format heap dump instead of ASCII, the
SIGWINCH is sent to the process.
NOTE: Before producing the heap dump, JVM performs a full GC.
60 Implementation specifics