Find my application memory foot print programmatically
<p>I am trying to measure my application memory foot print pragmatically.
I am using java.lang.management class to calculate this</p>

<pre><code>val heap = ManagementFactory.getMemoryMXBean.getHeapMemoryUsage
val nonHeap = ManagementFactory.getMemoryMXBean.getNonHeapMemoryUsage
val total = heap + nonHeap + (?)
</code></pre>

<p>I assumed the sum of both will give me the total amount of memory used by application, but this is not the case, the actual size is greater which was provided by top command.</p>

<p>So I am trying to understand what am I missing? What else do I need to add to this equation in order to get the total memory usage of my application.</p>