title: RAM memory usage is showing as 21g for a process where as Heap memory usage for the same process is 4gb. Where the remaining memory is going to?
body: <p>I have recently upgraded application server of a java application from JBoss to Wildfly. The application starts fine but RAM is filling up so fast. It is showing as 21gb used out of 23gb with free command.</p>
  <p><a href="https://i.stack.imgur.com/UKgLm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UKgLm.png" alt="enter image description here" /></a></p>
  <p>When I look at the processes using top command, the java process in question is taking 20.7g</p>
  <p><a href="https://i.stack.imgur.com/tC3OQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tC3OQ.png" alt="enter image description here" /></a></p>
  <p>But, when I try to debug the remote java process using jconsole, heap memory usage is ~4g</p>
  <p><a href="https://i.stack.imgur.com/kJRHn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kJRHn.png" alt="enter image description here" /></a></p>
  <p>If heap memory usage is 4g, then how come top command is showing that the same process memory usage is 20.7g and total RAM usage is 21g? What am I missing here and how to resolve this memory issue?</p>