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>



 

Different type of garbage collectors in java>

>Serial collector / Serial GC (Garbage collector) in java

>Throughput GC (Garbage collector) or Parallel collector in java

>Concurrent Mark Sweep (CMS) collector / concurrent low pause garbage collector in java

>G1 garbage collector / Garbage first collector in java


Young, Old (tenured) and Permanent Generation >

>What are Young, Old (tenured) and Permanent Generation in JVM in java


Minor, Major and Full garbage collection >

>What are Minor, Major and Full garbage collection in JVM in java


Important VM parameters >

>Most important and frequently used VM (JVM) PARAMETERS with examples in JVM Heap memory in java

>What are -XX:NewSize and -XX:MaxNewSize JVM parameters in java

>-XX:SurvivorRatio JVM parameters in java with examples - Setting survivor spaces size

>-XX:+AggressiveHeap VM parameters

>What are -XX:PermSize and -XX:MaxPermSize JVM parameters with examples in java | Differences

>Solve java.lang.OutOfMemoryError : unable to create new native Thread - Xss JVM option

More VM parameters >

>How to use -verbose:gc VM argument

>-Xverify option in java


eEdit
Must read for you :