advancedJVM Internals & Memory400 of 436

30 GB heap with a 10 ms pause budget: G1 or ZGC, and why?

Tests whether you pick ZGC -- G1's pause times scale with heap size and live-set complexity, typically landing in tens-to-hundreds of ms on a 30GB heap, while ZGC's concurrent, region-based collection keeps pauses sub-millisecond regardless of heap size, which is the only way to reliably hit a 10ms budget.

Ready to master this question?

Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.

Sign in to generate a response

Next Step

← Back to all Core Java questions