JDK 28 Lets ZGC Prepare Heap Memory in the Background, Ending the Startup-or-Warmup Trade-off
JEP 545 has landed in JDK 28 and moves ZGC's heap memory preparation onto concurrent worker threads. A new adaptive sizing option, paired with it, lets Java services start fast and warm up quickly without choosing between the two.

TL;DR
- JEP 545 moves ZGC's heap memory acquisition and preparation off the startup path in JDK 28, onto background worker threads.
- On Linux 6.1 and later, the collector can also upgrade small 4 KB pages to 2 MB pages while the application runs.
- The headline startup and warmup gains depend on adaptive heap sizing from the companion JEP 546, which is off by default.
The old trade-off
Until now, running ZGC meant picking one side of a compromise. Its pause times stay flat as the heap grows, but collection frequency rises when the heap is small, so a small heap triggers early and frequent cycles. Teams that wanted fast startup set a tiny initial heap with -Xms and accepted a slow warmup, because the collector had to acquire and prepare memory in small steps while the application was already allocating. Teams that wanted fast warmup set a large initial heap, often with -XX:+AlwaysPreTouch, and paid the full cost before the first request arrived. According to the JEP, the startup difference between those two setups is roughly a tenth of a second for a 2 MB heap against more than ten seconds for a 32 GB one on current hardware.
Preparation moves to background threads
JEP 545 gives this work to a new thread type, ZMemoryWorker, with one worker per heap partition. The workers commit and uncommit memory as the heap's capacity changes, and they touch memory before application threads reach it. Where possible they also merge small pages into large ones. The CPU budget is fixed: the ZConcurrentWorkersCPUShare setting is 0.25, so preparation uses at most a quarter of the available CPU. The JEP's own future work notes that better CPU sharing between concurrent collection and concurrent commit is still an open question.
Large pages without administrator setup
Large pages on Linux no longer need to be reserved by an administrator in advance. ZGC checks whether the kernel supports MADV_COLLAPSE, a madvise mode added in Linux 6.1. If the check passes and memory heating is enabled, the collector switches to a Collapse state and upgrades pages in the background. Because this call can race with the kernel's khugepaged daemon, the implementation retries on EAGAIN. InfoQ also points out two edge cases in the code: combining -XX:+UseLargePages with adaptive sizing and no -Xmx disables explicit large pages for the heap, and a persistent EAGAIN can make the retry loop spin indefinitely. The code attributes that second case to memory pinned through mlock or long-term DMA and treats it as a configuration error.
Adaptive sizing is the key switch
InfoQ notes that the JEP's case study numbers come from a third option. JDK 25 required choosing between a small heap for startup and a pre-touched large heap for warmup. On JDK 28, the command java -XX:+UseZGC -XX:+ZAdaptiveHeapSizing avoids that choice. The flag lowers the minimum and initial heap to 2 MB and raises the maximum heap ceiling to 100% of physical memory. Without it, ZGC uses the shared heap sizing path and a 25% ceiling, and the aggressive expansion that the measurements depend on does not happen. The case study reports a 38% drop in startup time for Spring PetClinic on a 32 GB machine, with warmup falling from 80 seconds to 10. Those are the JEP's figures, measured on its own setup.
InfoQ also reports that the 100% ceiling is more cautious in practice than it sounds. The policy tracks machine-wide memory and keeps a reserve, aiming to leave about a fifth of the machine free, and it enforces a twentieth. These margins widen when memory usage is unstable or compressed.
Why it matters
Services already running a modest heap on Linux 6.1 or later get concurrent pre-touch and background large pages without changing any flags, because memory heating is on by default. Teams that set a large pre-touched heap only to get fast warmup may be able to remove that setting, but only after they enable adaptive sizing and test the result. The JEP also warns that applications tuned around a larger initial heap may warm up more slowly and need re-tuning. Since the memory techniques are not meant to be identical across operating systems, large pages may be used by default on Linux and not on Windows, so cross-platform deployments should check their own behavior.
JDK 28 reaches Rampdown Phase One on December 3, 2026, and general availability is scheduled for March 9, 2027. Teams can check the resolved heap flags on early-access builds and the -Xlog:gc+init output before deciding what to change.
Sources
This article was written by Blozhik from the reporting below. Read the originals for full detail.
InJEP 545 Moves ZGC Memory Preparation off the Startup Path in JDK 28InfoQ

