When it comes to garbage collector and memory flags VMs from different vendors differ somewhat. Most flags aren't even properly documented by the usage printout of the VM themselves. This page tries to shine some light on what garbage collection related flags there are and what they are good for. It covers several Sun and IBM JVMs
Disclaimer: Please note that the data presented in this document has been gathered from several publicly available sources. It is a conscious selection of available VM parameters and even though we tried to check most of the facts presented this document may contain errors.
-Xloggc:<file>
[GC 325407K->83000K(776768K), 0.2300771 secs]
[GC 325816K->83372K(776768K), 0.2454258 secs]
[Full GC 267628K->83769K(776768K), 1.8479984 secs]
-Xloggc
-XX:+PrintGCDetails
this is the best setting for the free GCViewer.
-Xloggc
this is the best setting for the free GCViewer.
2.459: [GC 2.459: [DefNew: 3967K->0K(4032K), 0.0141600 secs]
8559K->7454K(16320K), 0.0143588 secs]
Total time for which application threads were stopped: 0.0468229 seconds
Application time: 0.5291524 seconds
5.350: [GC
Desired survivor size 32768 bytes, new threshold 1 (max 31)
- age 1: 57984 bytes, 57984 total
- age 2: 7552 bytes, 65536 total
756K->455K(1984K), 0.0097436 secs]
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
-XX:MaxHeapFreeRatio
-XX:MinHeapFreeRatio
-XX:NewSize
and -XX:MaxNewSize
-XX:NewRatio
and -XX:MaxNewSize
-XX:NewRatio
and -XX:NewSize
-XX:MaxPermSize
-XX:PermSize
-XX:+UseConcMarkSweepGC
.
-XX:+UseParallelGC
.
-XX:+UseParallelGC
is set.
By default a system with N CPUs uses N garbage collection threads.
-XX:+UseParallelGC
and has higher priority than
-XX:GCTimeRatio
.
1/(1+<ratio>)
.
-XX:+UseParallelGC
and has lower priority than
-XX:MaxGCPauseMillis
.
-XX:+UseParallelGC
is used.
-XX:+UseParallelGC
and
-XX:+UseAdaptiveSizePolicy
.
-XX:+UseParallelGC
.
Instead you may combine it with
-XX:+UseParNewGC
-XX:+UseParNewGC
option is in use the remark pauses may be
decreased with the -XX:+CMSParallelRemarkEnabled
option.
-XX:+UseConcMarkSweepGC
.
-Xincgc
-XX:+UseTrainGC
StackOverflowError
s.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
java.lang.System.gc()
.
-Xmx
in the calculation. For the client
VM the free heap is calculated using the actual current heap size.
Java 5.0 (1.5) defines a class of machines referred to as server-class machines. These are machines that have 2 or more physical processors and 2 or more gb of physical memory. On server-class machines the Sun JVM starts with altered default settings. These are:
-server -XX:+UseParallelGC
Additionally the initial heap size (-Xms
) is set to 1/64 of
the physical memory, up to 1gb. The maximum heap size (-Xmx
)
is set to 1/4 of the physical memory, up to 1gb.
Note that on server-class 32bit-Windows systems the VM will nevertheless start with the classic client settings, as most 32bit-Windows Java applications are not server applications.
Disclaimer: Please note that the data presented in this document has been gathered from several publicly available sources. It is a conscious selection of available VM parameters and even though we tried to check most of the facts presented this document may contain errors. Also note that the semantics of some of these parameters are different when used with IBM's resettable JVM for the z/OS platform.
-Xverbosegclog
X
and Y
are specified, the output
is redirected to X
files each containing output from
Y
GC cycles.
-verbose:gc
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
subpool
option was introduced in Version
1.4.1 Service Refresh 1 for AIX only.
optthruput
disables concurrent mark. If you do
not have pause time problems (as seen by erratic application response
times or by analysis of the verbose GC output), you should get the
best throughput with this option.
optthruput
is the default setting.
optavgpause
enables concurrent mark
with its default values. If you are having problems with erratic
application response times that are caused by normal garbage
collections, you can remove those problems at the cost of some
throughput when running with the optavgpause
option.
subpool
enables improved object allocation that
aims to achieve better performance in allocating objects on the heap.
This setting might provide additional throughput optimization
because it can improve the efficiency of object allocation and reduce
lock contention on large SMP systems. Concurrent mark is disabled
when this policy is enabled.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
k
, m
and
g
for kilobyte, megabyte and gigabyte.
java.lang.System.gc()
is called. Its default behavior with a java.lang.System.gc()
call is to perform a compaction only if an allocation failure triggered
a garbage collection since the last java.lang.System.gc()
call.
java.lang.System.gc()
is
called. Its default behavior with a java.lang.System.gc()
call is to perform a compaction only if an allocation failure triggered
a garbage collection since the last java.lang.System.gc()
call.
java.lang.System.gc()
into no-ops.