Can JMC handle multiple YoungGarbageCollectionEvents with the same value for the gcId field?

Erik Duveblad erik.helin at
Fri Jan 13 14:42:37 UTC 2023

Hey all,

I’m looking at the JFR events that will be sent for generational ZGC [0].

With generational ZGC there are broadly speaking two kinds of garbage collections (“minor” and “major”) and each garbage collection can collect one or more generations, zero or more times. More concretely, a minor garbage collection will collect the young generation once and a major garbage collection will collect the young generation _one or two times_ and the old generation once.

The JFR events I plan for generational ZGC to send are:

- a “jdk.GarbageCollection” event when a “minor” or “major” garbage collection occurs
- a “jdk.YoungGarbageCollection” event when the young generation is collected
- a “jdk.OldGarbageCollection” event when the old generation is collected

Combining the above means that there is a new situation: when a major garbage collection occurs that collects the young generation *two* times and the old generation once, then the following events will be sent:

- one “jdk.GarbageCollection” event with a given gcId “n"
- two “jdk.YoungGarbageCollection” events with the gcId field set to “n”
- one “jdk.OldGarbageCollection” event with the gcId field to to “n”

This would be the first time a HotSpot garbage collector sends multiple (two in this case) “jdk.YoungGarbageCollection” events with the same value for the gcId field. So I wanted to check with you all if JMC makes any assumptions or relies upon the fact that up until now all “jdk.YoungGarbageCollection” events have a unique value for the “gcId” field?



More information about the zgc-dev mailing list