"-XX:SurvivorRatio" - Ratio of Eden and Survivor Space

This section describes the default 'new' ratio (size ratio of tenured vs. 'new' generation).

Can we also control the ratio between "eden" space and survivor spaces? The answer is yes, by using the "-XX:SurvivorRatio" JVM option.

The ratio between "eden" space and survivor spaces is defined as "SurvivorRatio", which is the ratio of the "eden" space and one survivor space.

By default, the "SurvivorRatio" is set to about 8. You can verify this with test results listed in previous tutorials.

Below is another test with "-Xms20m -Xmx20m -XX:NewRatio=1 -XX:SurvivorRatio=6" options. The "new" generation should get 10 MB, which will be divided into: Eden space of 7.5 MB, "from" Survivor space of 1.25 MB and "to" Survivor space of 1.25 MB:

herong> \progra~1\java\jdk1.8.0\bin\java -Xms20m -Xmx20m \
   -XX:NewRatio=1 -XX:SurvivorRatio=6 \
   -XX:+UseSerialGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps \
   GarbageCollection
...
Heap
 def new generation   total 8960K, used 6973K [0x04800000, ...
  eden space 7680K,  74% used [...
  from space 1280K, 100% used [...
  to   space 1280K,   0% used [...
 tenured generation   total 10240K, used 6037K [0x05200000, ...
   the space 10240K,  58% used [0x05200000, 0x057e5568, ...
 Metaspace used 1561K, capacity 2242K, committed 2368K, reserved 4480K

The output confirms that the SurvivorRatio is about 6 (or 7680K/1280K).

Table of Contents

 About This Book

 Heap Memory Area and Size Control

 JVM Garbage Collection Logging

 Introduction of Garbage Collectors

Serial Collector - "+XX:+UseSerialGC"

 What Is Serial Collector

 GC Log Message Format for Serial Collector

 GC Log Message Examples of Serial Collector

 Log Message Types from Serial Collector

 Serial Collector Stops Application for Minor/Major GC

 Usage Report on Heap Memory Areas

 Default NewRatio - Old vs. New Generation

 "-XX:NewRatio" - Ratio of Tenured and "new" Generation

"-XX:SurvivorRatio" - Ratio of Eden and Survivor Space

 Serial GC Tracing - Tight Heap

 Serial GC Tracing - Plenty of Heap

 Serial GC Tracing - Aged Live Objects

 Serial GC Tracing - Tenuring Threshold

 "-XX:TargetSurvivorRatio" - Second Tenuring Condition

 Serial GC Tracing - Tenuring Threshold Controlled

 "-XX:+NeverTenure" and "-XX:+AlwaysTenure" not Working

 Minor GC Triggering Condition of Serial Collector

 Parallel Collector - "+XX:+UseParallelGC"

 Concurrent Mark-Sweep (CMS) Collector - "+XX:+UseConcMarkSweepGC"

 Garbage First (G1) Collector - "+XX:+UseG1GC"

 Object References and Garbage Collection

 Garbage Collection Performance Test Program

 Performance Tests on Serial Collector

 Performance Tests on Parallel collector

 Performance Tests on Concurrent collector

 Performance Tests on G1 collector

 Garbage Collection Performance Test Summary

 Archived Tutorials

 References

 Full Version in PDF/EPUB