Profile Image
vishnupriya

What is G1 GC tuning: -XX:G1MaxNewSizePercent?

What is G1 GC tuning: -XX:G1MaxNewSizePercent? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvmargument

  • xx-g1maxnewsizepercent

  • x-g1maxnewsizepercent

  • G1 GC tuning

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:

 

You can sets the percentage of the heap size to use as the maximum for the young generation size with:

 

-XX:G1MaxNewSizePercent=percent , where percent is the desired value in %.

 

Examples:

 

This will instruct JVM to use 50% of heap for the young generation:

 

-XX:G1MaxNewSizePercent=50

 

Description:

 

G1 (Garbage First) GC is designed for apps in multi-processor environments with large memory space (more than 4GB). It is available from the JDK7 Update 4. Unlike other collectors, the G1 collector partitions the heap into a set of equal-sized heap regions (usually 1MB to 32MB) chunks, prioritizes them, and then performs the garbage collection on those chunks based on the priority. We can tune G1 with additional options, one of them is G1MaxNewSizePercent.     Sets the percentage of the heap size to use as the maximum for the young generation size. The default value is 60 percent of your Java heap.

 

This is an experimental flag. This setting replaces the -XX:DefaultMaxNewGenPercent setting.

 

Default Value:

 

Default is 60%.

 

Errors:

 

The value should be between 0 and 100.

 

Arguments related:

 

TODO link UseG1GC, MinHeapFreeRatio, MaxHeapFreeRatio, Xmx, Xms, UseSerialGC, USeParNewGC, UseParallelGC, UseZGC

 

 Related Posts:

 NOTE:

 

If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your insights will help the entire 10+ million java developer community to develop one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvmargument

  • xx-g1maxnewsizepercent

  • x-g1maxnewsizepercent

  • G1 GC tuning