The JVM has spoiled us with its cleverness. It makes so many decisions behind the scenes, that lots of us gave up on looking at what’s inside. Memory-related discussions are probably more likely to appear at a conference or during a job interview than at “real” work. Of course, depending on what you work on.
Java apps are often run in containers these days. Built-in container awareness makes the JVM respect various container-specific limits (e.g. CPU, memory). This means, that even when running an app with a dummy java -jar app.jar
(which is usually not the best idea), everything should just work. That’s probably why the only memory-related option provided is often the -Xmx
flag (or any of its equivalents). In other words, we tend to only limit the maximum heap size, like this: