Runtime.maxMemory() and -Xmx

java, jvm

Solution

The interpretation of the -Xmx flag is VM-dependent. Some VMs, including HotSpot, enforce a lower bound on the effective value of this option. The CCC proposal should not have mentioned the -Xmx flag in this way.

Reference

Problem

I was expecting Runtime.maxMemory() to return exactly the -Xmx but it returns a lower value. So what does it return?

Original source