Java Reference
In-Depth Information
Table 13-2. Garbage Collection Settings
Switch
Effect
-XX:NewRatio=3
Sets the ratio of objects in the young generation to objects in the tenured
generation. This is a key setting for optimization, which we'll explore later
in this chapter.
-XX:NewSize=32M
Sets the minimum size of the new generation area. This is a key setting for
optimization, which we'll explore later in this chapter.
-XX:MaxNewSize=32M
Sets the maximum size of the new generation area. This is a key setting for
optimization, which we'll explore later in this chapter.
-XX:MaxHeapFreeRatio=70
If the free memory after a scavenge or collection is less than the indicated
percentage of total available memory, set total available memory to that
value. This setting lets memory grow into the free space again. Its default
value is 70. Remember that the JVM grows or shrinks the heap at each
collection in order to preserve this ratio (within certain bounds).
-XX:MinHeapFreeRatio=40
If the free memory after a scavenge or collection is less than the indicated
percentage of total available memory, this sets the total available memory
to the value given in the argument. This setting keeps some memory
immediately available in situations where the garbage collector has
recovered a lot of memory. Its default value is 40.
-XX:MaxPermSize=64m
Sets the size of the permanent generation. If your program has a lot of
classes, you may gain better performance by increasing this value. Its
default is 64M (that is, 64 megabytes).
-
XX:+ScavengeBeforeFullGC
Before trying to do a full collection, this scavenges first. If the result of the
scavenge puts free memory in the desired range, a full collection isn't
done.
-XX:-UseParallelGC
Uses parallel garbage collection for scavenges. Specifically, it uses one
thread per processor on the machine. As a rule, for a single processor
machine, this results in a loss of performance. On a two-processor
machine, it's roughly equivalent. On machines with more than two
processors, it's faster. The opposite setting is -XX:-UseSerialGC
-XX:-UseParallelOldGC
Uses parallel garbage collection for both scavenges and full collections.
The same rules for efficiency on multiple processors applies.
-XX:-UseSerialGC
Uses serial garbage collection for both scavenges and full collections. This
setting is more efficient on machines with only one processor (or machines
with multiple processors that are running your Java program on just one
processor).
Search WWH ::




Custom Search