Search code examples
garbage-collectionjava-11

Understanding GC1 log file in java 11


As part of the question in Java 11 GC logging I am struggling to understand what the numbers actually mean.

For example:

  [2020-07-14T10:01:14.791-0400][gc            ] GC(353) Pause Young (Normal) (G1 Evacuation Pause) 163M->16M(248M) 1.689ms
[2020-07-14T10:01:14.790-0400][gc,heap       ] GC(353) Eden regions: 147->0(147)
[2020-07-14T10:01:14.790-0400][gc,heap       ] GC(353) Survivor regions: 1->1(19)
[2020-07-14T10:01:14.790-0400][gc,heap       ] GC(353) Old regions: 16->16
[2020-07-14T10:01:14.790-0400][gc,heap       ] GC(353) Humongous regions: 1->1

I know that 147->0 is before/after collection, but what is the unit here and for the ones below? As I see it, is that the whole young generation is reduced from 163M to 16M , it also looks like this happens almost entirely within the Eden regions - so the objects already went out of scope before even moving to the survivor space?


Solution

  • what is the unit here

    A region. Region size varies based on heap size or an explicit setting.

    it also looks like this happens almost entirely within the Eden regions - so the objects already went out of scope before even moving to the survivor space?

    Most of them, a small amount might still trickle into later generations but on the other hand those regions may also contain now-dead objects that can be collected so it's mostly in equilibrium with only a very small flow towards the old generation. This kind of behavior is what makes generational collectors so efficient.