I have the following host with the memory details:
$free -m
total used free shared buffers cached
Mem: 7872
Memory used by Java process (as seen by the OS) is not only limited to Java Heap. There are a lot more memory areas that should be also counted:
Use NativeMemoryTracking JDK feature to get the detailed breakdown of memory areas used by JVM:
java -XX:NativeMemoryTracking=detail -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics