Java GC Tutorials - Herong's Tutorial Examples - Version 1.01, by Dr. Herong Yang
"-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:
C:\>\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).
Last update: 2018.
Table of Contents