Java 8 GC Tutorials - Herong's Tutorial Examples - v1.03, by Dr. Herong Yang
PSYoungGen Collector Using Tenuring Age
This section demonstrates that the PSYoungGen Collector uses Tenuring Age to perform Young generation GC. But it does not maintain the object age distribution list.
Does the PSYoungGen collector use Tenuring Age Distribution? Let's use our second test program, GarbageCollection2.java to find out:
herong> \progra~1\java\jdk1.8.0\bin\java -XX:+UseParallelGC \ -Xms1200m -Xmx1200m -XX:NewRatio=1 -XX:SurvivorRatio=1 \ -XX:+PrintGCDetails -XX:+PrintGCTimeStamps \ -XX:+PrintTenuringDistribution GarbageCollection2 > output.txt (Ctrl-C) herong> more output.txt 0.199: [GC (Allocation Failure) Desired survivor size 209715200 bytes, new threshold 7 (max 15) [PSYoungGen: 203779K->32024K(409600K)] 203779K->32028K(1024000K), 0.0161477 secs] 0.246: [GC (Allocation Failure) Desired survivor size 209715200 bytes, new threshold 7 (max 15) [PSYoungGen: 236745K->32000K(409600K)] 236749K->32004K(1024000K), 0.0160974 secs] ... 2.668: [GC (Allocation Failure) Desired survivor size 33292288 bytes, new threshold 1 (max 15) [PSYoungGen: 580330K->31744K(581888K)] 583671K->35085K(1196288K), 0.0121899 secs] Heap PSYoungGen total 581888K, used 312786K [... eden space 549376K, 51% used [0x2a000000,0x3b274700,0x4b880000) from space 32512K, 97% used [0x4d840000,0x4f7401f0,0x4f800000) to space 32512K, 0% used [0x4b880000,0x4b880000,0x4d840000) ParOldGen total 614400K, used 3341K [... object space 614400K, 0% used [0x04800000,0x04b43588,0x2a000000) Metaspace used 1571K, capacity 2242K, committed 2368K, reserved 4480K
The output confirms that the PSYoungGen collector does use tenuring age to control when to promote live objects in "from" space to "tenured" generation.
But the PSYoungGen collector does not maintain the object age distribution list as we saw for the Serial collector.
Table of Contents
Heap Memory Area and Size Control
JVM Garbage Collection Logging
Introduction of Garbage Collectors
Serial Collector - "+XX:+UseSerialGC"
►Parallel Collector - "+XX:+UseParallelGC"
Parallel Collector GC Log Message Format
"-XX:+PrintGCTaskTimeStamps" - Print GC Threads
"-XX:ParallelGCThreads=n" - # of Threads
Parallel Collector Stops Application for Minor/Major GC
►PSYoungGen Collector Using Tenuring Age
Parallel Collector Changing NewRatio and SurvivorRatio
Parallel Collector Adaptive Size Policy
Adaptive Size Policy Log Messages
"-XX:+PrintAdaptiveSizePolicy" - Minor GC Report
Adaptive Size Policy Changed Survivor Space
Adaptive Size Policy Changed Eden Space
Adaptive Size Policy for Best Latency
Adaptive Size Policy for Best Throughput
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