What is -XX:NewRatio JVM parameters in java - Setting young and old generation ratio


In this core java tutorial we will learn What is -XX:NewRatio JVM parameters in java.

Contents of page >
  • What is -XX:NewRatio JVM parameter in java?
    • Examples of using -XX:NewRatio VM option in java >
  • Summary -


Before learning about -XX:NewRatio JVM parameter in java we must know about java heap memory structure.

Earlier we read about JVM Heap memory (Hotspot heap structure)  in java consists of following elements>
  1. Young Generation
    • 1a) Eden,
    • 1b) S0 (Survivor space 0)
    • 1c) S1 (Survivor space 1)
  2. Old Generation (Tenured)
  3. Permanent Generation.


What is -XX:NewRatio JVM parameter in java?
-XX:NewRatio : NewRatio controls the size of young and old generation.
-XX:NewRatio sets the ratio between young and old generation in JVM heap memory in java.

Examples of using -XX:NewRatio  VM option in java >

Example1 of using -XX:NewRatio  VM option in java >
-XX:NewRatio=3 means that the ratio between the young and old/tenured generation is 1:3.
In other words, the combined size of the eden and survivor spaces will be one fourth of the total heap size.

Example2 of using -XX:NewRatio  VM option in java >
-XX:NewRatio=2 means that the ratio between the young and old/tenured generation is 1:2.
In other words, the combined size of the eden and survivor spaces will be one third of the total heap size.




Summary -

So in this core java tutorial we learned what is -XX:NewRatio JVM parameters in java. And how to use -XX:NewRatio VM parameter with examples.


Having any doubt? or you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.



RELATED LINKS>


No comments:

Post a Comment