In short, one of the engineers was investigating the excessive memory usage of a particular application which, by his knowledge was given 2G of heap to work with. But for whatever reason, the JVM tooling itself seemed to have not made up their mind on how much memory the process really has. For example jconsole guessed the total available heap to be equal to 1,963M while jvisualvmclaimed it to be equal to 2,048M. So which one of the tools was correct and why was the other displaying different information?
It was indeed weird, especially seeing that the usual suspects were eliminated – the JVM was not pulling any obvious tricks as:
- -Xmx and -Xms were equal so that the reported numbers were not changed during runtime heap increases
- JVM was prevented from dynamically resizing memory pools by turning off adaptive sizing policy (-XX:-UseAdaptiveSizePolicy)