Your Java Container Is Lying to You About Its Memory (opens in new tab)
The part of memory Java doesn't tell you about Java doesn't just use heap. The JVM also allocates: Metaspace — class metadata, loaded by the JVM itself Code cache — JIT-compiled native code Thread stacks — each thread gets its own Direct byte buffers (NIO) — allocated off-heap by many libraries Internal JVM bookkeeping This is called native memory, and it's invisible to your usual heap monitoring. When your container hits its cgroup memory limit, the kernel doesn't care how much heap you have...
Read the original article