Java / Java 17 Garbage Collection Interview Questions
What happens during a G1 GC mixed collection?
Once G1's concurrent marking cycle finishes identifying which old regions hold the most garbage, G1 enters a mixed collection phase: subsequent evacuation pauses combine the usual young regions with a handful of the highest-garbage old regions selected during marking, copying their live objects out and reclaiming the rest.
This continues across several pauses - governed by -XX:G1MixedGCCountTarget (default 8) and -XX:G1HeapWastePercent, which stops mixed collections once the remaining reclaimable garbage drops below a threshold not worth the pause-time cost - until G1 falls back into young-only collections and waits for the next concurrent cycle to trigger.
More Related questions...