When you move from Java 8 to any of Java 11 through 25, the GC the JVM picks when you don't specify one (the default GC) changes from Parallel to G1. A GC is the mechanism that collects the memory of objects no longer in use. Parallel and G1 are names of two kinds of GC.
With this change, container memory (cgroup memory.current ) no longer drops after a load peak passes.
I ran the same program under the same load on each version and compared how much container memory changed after the peak 1 .
Version Change after the peak
Java 8 −234.6 to −227.6MB
Java 11 0.0 to +2.9MB
Java 25 +2.3 to +2.7MB
In this article, the committed heap is the amount of heap the JVM has taken from the OS, and shrinking means reducing the committed heap and returning that memory to the OS.…