6 min read
JDK 28 takes ZGC memory preparation off the startup path

- Reading
- 6 min
- Code
- 2
JEP 545 moves ZGC's heap allocation and warmup to dedicated concurrent threads, cutting startup time by 38% and warmup from 80 to 10 seconds in the official test case.
JEP 545, titled "Faster Startup and Warmup with ZGC", was integrated into JDK 28 this week. It solves a known problem for anyone running the ZGC collector in production: until now, preparing heap memory was synchronous work, done on the JVM's startup path. Starting with JDK 28, that work moves off the starting line and into dedicated concurrent threads.
The trade-off ZGC always forced
ZGC has a well-known characteristic: its pauses don't grow with heap size, but collection frequency does. This means a small heap triggers collection cycles early and often, while a large heap postpones that problem, but costs more to prepare.
Before JDK 28, ZGC's default ergonomic behavior reserved 1/64 of the machine's physical memory as the initial heap. That left teams with two options, neither of them good:
- Team that prioritizes startup: small
-Xms, accepting a long warmup, because the collector needs to acquire and prepare memory gradually while the application is already allocating. - Team that prioritizes warmup: large
-Xms, usually with-XX:+AlwaysPreTouch, paying the full cost of memory preparation before the first request arrives.
JEP 545 puts numbers on this trade-off: starting with a 2 MB heap takes about a tenth of a second on current hardware, versus more than ten seconds for a fully pre-warmed 32 GB heap.
ZMemoryWorker: one thread per heap partition
The core technical change is a new thread, ZMemoryWorker, created one per heap partition. It performs, in parallel with the application, the work that used to block startup: committing and uncommitting memory as capacity changes, and "warming" memory before the application's threads reach it.
Warming memory, in the JEP's vocabulary, means pre-touching page by page and collapsing small pages into large pages. On Linux 6.1 or newer, this includes promoting 4 KB pages to 2 MB pages while the application is already running, without requiring an administrator to reserve huge pages in advance.
The CPU budget for this concurrent work is fixed, not adaptive: the constant ZConcurrentWorkersCPUShare, defined in zGlobals.hpp, is set to 0.25, meaning memory preparation consumes at most a quarter of the available CPU. When adaptive heap sizing is on, the ZGC director also limits the number of young-generation workers to keep collection within the CPU target, even while the heap deliberately expands beyond the heuristic target size.
How Linux gets huge pages without manual configuration
The large pages part on Linux depends on a specific kernel feature: MADV_COLLAPSE, a mode of madvise added in Linux 6.1. ZGC probes for this support by mapping a 4 MB region, pre-touching a single page, and trying to collapse an aligned 2 MB range.
When the probe succeeds and memory warming is enabled, the collector enters a new internal state called Collapse and promotes pages in the background. This call competes for resources with the kernel's own khugepaged, so the implementation retries whenever it receives EAGAIN.
The numbers from the test case: Spring PetClinic
The JEP compares three command-line configurations to measure the actual gain:
# JDK 25, tuned for startup
java -XX:+UseZGC -Xms2m -Xmx32g -jar app.jar
# JDK 25, tuned for warmup
java -XX:+UseZGC -Xms32g -Xmx32g -XX:+AlwaysPreTouch -jar app.jar
# JDK 28, without choosing the trade-off
java -XX:+UseZGC -XX:+ZAdaptiveHeapSizing -jar app.jarThe third line, with the -XX:+ZAdaptiveHeapSizing flag, produces the numbers that give the JEP its angle: a 38% drop in startup time and warmup falling from 80 seconds to 10 seconds, running Spring PetClinic on a machine with 32 GB of memory.
This flag belongs to JEP 546, companion to 545, and still ships off by default. Turning it on drops the minimum and initial heap to the 2 MB floor and raises the MaxHeapSize ceiling from 25% of physical memory (the default without the flag) to 100%. Without -XX:+ZAdaptiveHeapSizing, ZGC still gains concurrent memory preparation, but not the aggressive heap expansion that the case study numbers depend on.
What changes without touching a single flag
Services already running ZGC with a modest heap on Linux 6.1 or newer automatically gain concurrent pre-touching and background huge pages, because memory warming ships enabled by default in JDK 28. Nothing needs to change in the command line for that.
Services that today carry a large pre-warmed heap just to buy fast warmup have something they can remove from their configuration, but only after enabling adaptive sizing. The 100% physical memory ceiling sounds riskier than it is in practice: the allocation policy monitors the whole machine's usage and prefers to leave a fifth of it free, fighting for a tenth and imposing a twentieth as a hard limit, with these margins increasing when memory usage becomes unstable.
How to check the effect on resolved flags
For anyone who wants to see the difference before deciding, the JEP suggests comparing the final flags between the two configurations:
java -XX:+UseZGC -XX:+PrintFlagsFinal -version | grep -E "MinHeapSize|InitialHeapSize|MaxHeapSize"
java -XX:+UseZGC -XX:+ZAdaptiveHeapSizing -XX:+PrintFlagsFinal -version | grep -E "MinHeapSize|InitialHeapSize|MaxHeapSize"The second run drops the minimum and initial sizes to the 2 MB floor and raises the maximum from a quarter of physical memory to all of it. Adding -Xlog:gc+init to the command, the log reports Memory Heating: Enabled and, when the collapse path is active, Large Page Support: Enabled (Transparent, JVM enforced).
The gotchas buried in the fine print
Not everything is automatic and cost-free. The JEP itself is explicit: using identical memory techniques across every operating system is a declared non-goal of the project. Large pages may be default on Linux and not on Windows, and applications tuned around a large initial heap may warm up more slowly on JDK 28, requiring re-tuning.
Two edge-case behaviors live only in the code, not in the JEP's text:
- Combining
-XX:+UseLargePageswith adaptive sizing without setting-Xmxgenerates a log warning and disables explicit large-page support for the heap. - The retry loop around
MADV_COLLAPSEcan spin indefinitely whenEAGAINpersists, a case the code attributes to pinning viamlockor long-running DMA, and treats as a user configuration error, not a collector bug.
Timeline and what comes next
JDK 28 enters Rampdown Phase One on December 3, 2026, with general availability set for March 9, 2027. JEP 545 itself lists as future work better CPU sharing between concurrent collection and concurrent commit, plus integration with JEP 544, ahead-of-time compilation already complete for JDK 28, which frees up JIT cycles that the memory threads could use.
For anyone running Java services in production with a tight startup SLA, whether on Kubernetes with aggressive autoscaling or in serverless functions running a JVM, the change reduces the pressure to choose between two extremes of heap tuning. It's worth testing JDK 28's early-access builds, comparing the resolved flags, before deciding whether migrating the production configuration pays off.
Translated from the Brazilian Portuguese original · Read the original
CrowdStrike Buys Zscaler for $44 Billion, Targets AI Agent Security
The all-stock deal values Zscaler at $260.41 per share and creates a company with more than $10 billion in recurring revenue. For those running Falcon and Zero Trust Exchange in production, the merger doesn't change anything in the code yet, but it raises signals worth monitoring.





