7.15.8 Young GC
|
|
- Organization of this subsection
(1) Triggers
-
Young GC (normal)
Young GC (normal) occurs when there is not enough space for an object in the Eden area. It also occurs when the Humongous area does not have enough space to accommodate a large object.
-
Young GC (initial-mark)
If the used size of the Tenured area exceeds 45% of the Java heap area when young GC (normal) finishes, young GC (initial-mark) is executed when the trigger in 1. is satisfied. When securing the space for a large object, if the total of the used size of the Tenured area and the size of the object exceeds 45% of the Java heap area, then young GC (initial-mark) is executed.
(2) Target
New area
(3) Processing
-
When young GC occurs, a single thread performs region selection, followed by multi-threaded evacuation.
-
Evacuation in young GC entails moving in-use objects from the Eden area and the From space to the To space or the Tenured area, and reclaiming the Eden area and the From space. The mechanisms for moving and recovering objects are the same as for copy GC. For details about copy GC, see 7.2.3 Mechanism of copy GC.
-
Young GC estimates the GC pause time based on information about GC executed in the past, and resizes the New area so that the predicted pause time of the next GC falls within the target pause time.
-
The New area has a minimum size and a maximum size, and is resized within these bounds. Because all GC methods target the New area, the GC pause time cannot be shorter than the GC pause time if the New area is the minimum size.
-
When young GC occurs after CM has completed, if the predicted collected size exceeds 10% of the Java heap area, the system determines whether to perform mixed GC for the next GC. If mixed GC is selected for the next GC, then the JavaVM predicts that GC will mainly target Tenured regions and resizes the New area accordingly.
-
The evacuation processing of young GC (initial-mark) marks objects that are directly referenced by local variables and in-use objects during evacuation. The Concurrent Marking processing uses the results of this marking. For details about Concurrent Marking, see 7.15.9 Concurrent Marking (CM).
(4) Processing results
Eden area: The objects are collected and the area is left empty. The Eden area is resized after GC has completed.
Survivor area: The objects in the From space are collected and the space is left empty. The Survivor area is resized after GC has completed.
Tenured area: Objects determined to have long-term utility are moved to the Tenured area.
Humongous area: Unchanged.
Metaspace area: Unchanged.
Free area: The Free area increases or decreases in size as a result of the resizing that occurs after GC.
(5) Pausing of applications
Applications are paused.
(6) Relationship with other GC methods
CM: Not executed during young GC.
Mixed GC: Not executed during young GC.
Full GC: If the requirements for Full GC are met while young GC is in progress, young GC is canceled and Full GC is executed.
(7) Supplementary notes
-
Related options
You can use the -XX:ParallelGCThreads option to change the number of threads involved in evacuation. By increasing the number of threads, you can reduce the time young GC takes to complete. If you do not specify this option, GC uses the default value of the -XX:ParallelGCThreads option. For details about the -XX:ParallelGCThreads option, see 14.5 Java HotSpot VM options that can be specified in Cosminexus in the uCosminexus Application Server Definition Reference Guide.
-
Confirmation method
You can confirm that young GC has occurred when YoungGC or YoungGC(initial-mark) appears as the GC type in the log file. You can also confirm the resizing of the New area based on how the sizes of the Eden area and the survivor area have changed.
[VG1]<Wed Jun 12 11:21:10 2013>[Young GC 899070K/899072K(1048576K)->501755K/501760K(1048576K), 0.0931560 secs][Status:-][G1GC::Eden: 389120K(389120K)->0K(397312K)][G1GC::Survivor: 41984K->41984K][G1GC::Tenured: 459776K->459776K][G1GC::Humongous: 2048K->2048K][G1GC::Free: 609536K->607232K][Metaspace: 3634K(4492K, 4492K)->3634K(4492K, 4492K)][class space: 356K(388K, 388K)->356K(388K, 388K)][cause:G1EvacuationPause][RegionSize: 1024K][Target: 0.2000000 secs][Predicted: 0.2495800 secs][TargetTenured: 0K][Reclaimable: 0K(0.00%)][User: 0.0156250 secs][Sys: 0.0312500 secs][IM: 729K, 928K, 0K][TC: 509][DOE: 16K, 171][CCI: 2301K, 49152K, 2304K]
In the preceding log file entry, the size of the New area before GC is 389120K + 41984K = 431104K, and the size of the New area after GC is 397312K + 41984K = 439296K. This shows that the New area has been extended. For details about how to interpret this information, see -XX:[+|-]HitachiVerboseGC (Option for extended verbosegc information output) in the uCosminexus Application Server Definition Reference Guide.