A GC event is a recorded garbage-collection operation. Its log identifies the collection type, reports work performed in phases, measures timing, and shows how heap regions changed afterward. section 11.1
Read a GC event by checking:
- The collection kind, such as a G1 young evacuation pause. section 11.1
- The phases and their durations, including evacuation and other work. section 11.1
- The heap-region transitions: Eden, Survivor, Old, and Humongous regions before and after collection. section 11.1
Enable and inspect an event
Run an application with `java -Xlog:gc* -jar app.jar`. A typical event begins with `GC(0)` and identifies a young G1 evacuation pause, its worker count and phases, then reports changes such as Eden `4->0` and Survivor `0->1`. section 11.1
Listing 11.2 Logs related to events of a GC event of memory collecting
[1.336s][info][gc,start] GC(0) ➥ Pause Young (Normal)(G1 Evacuation Pause) #1 [1.337s][info][gc,task] GC(0) ➥ Using 8 workers of 8 for evacuation #2 [1.342s][info][gc,phases] GC(0) ➥ Pre Evacuate Collection Set: 0.13ms #3 [1.342s][info][gc,phases] GC(0) ➥ Merge Heap Roots: 0.20ms #4 [1.342s][info][gc,phases] GC(0) ➥ Evacuate Collection Set: 4.04ms #5 [1.342s][info][gc,phases] GC(0) ➥ Post Evacuate Collection Set: 0.73ms #6 [1.342s][info][gc,phases] GC(0) Other: 0.71ms
Inspect a concrete event log showing collection type, worker activity, phase durations, and elapsed time. section 11.1
