0

We use the G1 collector.
When a young GC occurs (not mixed GC),the change of heap: [Eden: 3666.0M(3666.0M)->0.0B(3632.0M) Survivors: 20.0M->54.0M Heap: 5346.0M(6144.0M)->526.9M(6144.0M)].

The change of heap is 4819.1M(5346.0-526.9)

Eden changed 3666.0(3666.0-0.0) and Survivors -34M(20-54); why does the change of heap not equal the sum of Eden and Survivors(4819.1 not equal (3666.0-34))? Does the young GC clear objects in the old generation?

gc log:

2021-04-06T03:00:51.872+0800: 296723.143: [GC pause (G1 Evacuation Pause) (young), 0.0483384 secs]
   [Parallel Time: 16.3 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 296723144.3, Avg: 296723144.3, Max: 296723144.4, Diff: 0.2]
      [Ext Root Scanning (ms): Min: 2.0, Avg: 2.5, Max: 3.8, Diff: 1.9, Sum: 20.0]
      [Update RS (ms): Min: 8.7, Avg: 9.8, Max: 10.2, Diff: 1.4, Sum: 78.5]
         [Processed Buffers: Min: 114, Avg: 124.2, Max: 145, Diff: 31, Sum: 994]
      [Scan RS (ms): Min: 1.0, Avg: 1.0, Max: 1.1, Diff: 0.1, Sum: 8.3]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [Object Copy (ms): Min: 2.4, Avg: 2.6, Max: 2.7, Diff: 0.3, Sum: 20.4]
      [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
         [Termination Attempts: Min: 1, Avg: 1.4, Max: 2, Diff: 1, Sum: 11]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.1]
      [GC Worker Total (ms): Min: 15.9, Avg: 16.1, Max: 16.1, Diff: 0.2, Sum: 128.4]
      [GC Worker End (ms): Min: 296723160.3, Avg: 296723160.4, Max: 296723160.5, Diff: 0.2]
   [Code Root Fixup: 0.2 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.7 ms]
   [Other: 31.2 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 25.6 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.3 ms]
      [Humongous Register: 0.3 ms]
      [Humongous Reclaim: 1.6 ms]
      [Free CSet: 2.2 ms]
   [Eden: 3666.0M(3666.0M)->0.0B(3632.0M) Survivors: 20.0M->54.0M Heap: 5346.0M(6144.0M)->526.9M(6144.0M)]
 [Times: user=0.15 sys=0.02, real=0.04 secs] 
2021-04-06T03:02:23.524+0800: 296814.796: [GC pause (G1 Evacuation Pause) (young), 0.0485279 secs]
   [Parallel Time: 21.0 ms, GC Workers: 8]
      [GC Worker Start (ms): Min: 296814796.9, Avg: 296814797.0, Max: 296814797.1, Diff: 0.2]
      [Ext Root Scanning (ms): Min: 2.1, Avg: 2.5, Max: 3.9, Diff: 1.8, Sum: 20.0]
      [Update RS (ms): Min: 9.1, Avg: 10.3, Max: 10.6, Diff: 1.4, Sum: 82.0]
         [Processed Buffers: Min: 114, Avg: 126.0, Max: 134, Diff: 20, Sum: 1008]
      [Scan RS (ms): Min: 1.0, Avg: 1.1, Max: 1.2, Diff: 0.1, Sum: 8.6]
      [Code Root Scanning (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.1]
      [Object Copy (ms): Min: 6.5, Avg: 6.7, Max: 6.9, Diff: 0.3, Sum: 53.6]
      [Termination (ms): Min: 0.0, Avg: 0.0, Max: 0.0, Diff: 0.0, Sum: 0.0]
         [Termination Attempts: Min: 1, Avg: 1.0, Max: 1, Diff: 0, Sum: 8]
      [GC Worker Other (ms): Min: 0.0, Avg: 0.1, Max: 0.2, Diff: 0.2, Sum: 1.0]
      [GC Worker Total (ms): Min: 20.5, Avg: 20.7, Max: 20.8, Diff: 0.3, Sum: 165.4]
      [GC Worker End (ms): Min: 296814817.5, Avg: 296814817.6, Max: 296814817.7, Diff: 0.2]
   [Code Root Fixup: 0.2 ms]
   [Code Root Purge: 0.0 ms]
   [Clear CT: 0.7 ms]
   [Other: 26.7 ms]
      [Choose CSet: 0.0 ms]
      [Ref Proc: 21.3 ms]
      [Ref Enq: 0.0 ms]
      [Redirty Cards: 0.2 ms]
      [Humongous Register: 0.3 ms]
      [Humongous Reclaim: 1.6 ms]
      [Free CSet: 2.0 ms]
   [Eden: 3632.0M(3632.0M)->0.0B(3632.0M) Survivors: 54.0M->54.0M Heap: 5390.6M(6144.0M)->526.9M(6144.0M)]
 [Times: user=0.18 sys=0.01, real=0.05 secs] 

AlBlue
  • 23,254
  • 14
  • 71
  • 91
O.Tiger
  • 1
  • 1
  • 1
    Does that answer your question: [Why Old generation objects clearing up by minor GC](https://stackoverflow.com/q/66949589/2711488)? – Holger Apr 13 '21 at 09:25
  • Thanks, It's not the answer I want :) – O.Tiger Apr 13 '21 at 09:42
  • you might simply miss-read the logs. A mixed GC triggers a young GC, first. So look at the logs down the line - do you see a mixed GC after this young one? – Eugene Apr 14 '21 at 14:29
  • why the log show it is a young GC? the logs : 2021-04-06T03:00:51.872+0800: 296723.143: [GC pause (G1 Evacuation Pause) (young), 0.0483384 secs] – O.Tiger Apr 15 '21 at 00:11
  • again: _after_ that young GC, do you see a _mixed_ one? – Eugene Apr 15 '21 at 01:35
  • yes,after 15min there has a mixed GC, it was not the same time,It's relevant? – O.Tiger Apr 16 '21 at 00:25

1 Answers1

0

This is because the work being done is a mixed GC, so it's not just cleaning out Eden, it's also clearing some other regions as well.

AlBlue
  • 23,254
  • 14
  • 71
  • 91
  • It could help to clarify why it's "mixed" because they said that "When a young GC occurs (not mixed GC)..." – Juraj Martinka Apr 13 '21 at 18:33
  • But the log show it is a young GC , tho logs : 2021-04-06T03:00:51.872+0800: 296723.143: [GC pause (G1 Evacuation Pause) (young), 0.0483384 secs] – O.Tiger Apr 15 '21 at 00:14