Thursday, November 15, 2007

Java Heap Size Options

Setting the New generation heap size

-XX:NewSize

Use this option to set the New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set -XX:NewSize to be one-fourth the size of the maximum heap size. Increase the value of this option for larger numbers of short-lived objects.

Be sure to increase the New generation as you increase the number of processors. Memory allocation can be parallel, but garbage collection is not parallel.

Setting the maximum New generation heap size

-XX:MaxNewSize

Use this option to set the maximum New generation Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.

Setting New heap size ratios

-XX:SurvivorRatio

The New generation area is divided into three sub-areas: Eden, and two survivor spaces that are equal in size.

Use the -XX:SurvivorRatio=X option to configure the ratio of the Eden/survivor space size. Try setting this value to 8 and then monitor your garbage collection.

Setting minimum heap size

-Xms

Use this option to set the minimum size of the memory allocation pool. Set this value to a multiple of 1024 that is greater than 1MB. As a general rule, set minimum heap size -Xms equal to the maximum heap size -Xmx.

Setting maximum heap size

-Xmx

Use this option to set the maximum Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.

About Generational GC
JVM heap size
Heap Size
Heap Size Options
Heap Size
OutOfMemoryExeception

No comments:

Post a Comment

Recent Posts

Unix Commands | List all My Posts

Texts

This blog intended to share the knowledge and contribute to JAVA Community such a way that by providing samples and pointing right documents/webpages. We try to give our knowledege level best and no guarantee can be claimed on truth. Copyright and Terms of Policy refer blogspot.com