Documentation Contents |
On server-class machines running
the server VM, the garbage collector (GC) has changed from
the previous serial collector (-XX:+UseSerialGC
) to a
parallel collector (-XX:+UseParallelGC
). You can
override this default by using the -XX:+UseSerialGC
command-line option to the java
command.
-XX:+UseParallelGC
) the initial
heap size and maximum heap size have changed as follows.
Larger of 1/64th of the machine's physical memory on the machine
or some reasonable minimum. Before J2SE 5.0, the default initial
heap size was a reasonable minimum, which varies by platform. You
can override this default using the -Xms
command-line
option.
Smaller of 1/4th of the physical memory or 1GB. Before J2SE 5.0,
the default maximum heap size was 64MB. You can override this
default using the -Xmx
command-line option.
The parallel garbage collector (UseParallelGC
)
throws an out-of-memory exception if an excessive amount of time is
being spent collecting a small amount of the heap. To avoid this
exception, you can increase the size of the heap. You can also set
the parameters -XX:GCTimeLimit=
time-limit and
-XX:GCHeapFreeLimit=
space-limit where:
-XX:+UseAdaptiveSizePolicy
used by default with the -XX:+UseParallelGC
garbage
collector has changed to consider three goals:The implementation checks (in this order):
Flags
-XX:MaxGCPauseMillis=
nnnBy default there is no pause time goal. There are definite limitations on how well a pause time goal can be met. The pause time for a GC depends on the amount of live data in the heap. The minor and major collections depend in different ways on the amount of live data. This parameter should be used with caution. A value that is too small will cause the system to spend an excessive amount of time doing garbage collection.
-XX:GCTimeRatio=
nnnFor example -XX:GCTimeRatio=19
sets a goal of 5% of
the total time for GC and throughput goal of 95%. That is, the
application should get 19 times as much time as the collector.
By default the value is 99, meaning the application should get at least 99 times as much time as the collector. That is, the collector should run for not more than 1% of the total time. This was selected as a good choice for server applications. A value that is too high will cause the size of the heap to grow to its maximum.
Suggested strategy
Do not choose a maximum value for the heap unless you know that the heap is greater than the default maximum heap size. Choose a throughput goal that is sufficient for your application.
In an ideal situation the heap will grow to a value (less than the maximum) that will support the chosen throughput goal.
If the heap grows to its maximum, the throughput cannot be met within that maximum. Set the maximum heap as large as you can, but no larger than the size of physical memory on the platform, and execute the application again. If the throughput goal can still not be met, then it is too high for the available memory on the platform.
If the throughput goal can be met but there are pauses that are too long, select a pause time goal. This will likely mean that your throughput goal will not be met, so choose values that are an acceptable compromise for the application.
Copyright © 1993, 2010, Oracle and/or its affiliates. All rights reserved. Please send comments using this Feedback page. |
Java Technology |