I am trying to correctly measure print in application memory. I use the java.lang.management class to calculate this
val heap = ManagementFactory.getMemoryMXBean.getHeapMemoryUsage val nonHeap = ManagementFactory.getMemoryMXBean.getNonHeapMemoryUsage val total = heap + nonHeap + (?)
I assumed that the sum of both will give me the total amount of memory used by the application, but this is not so, the actual size is larger than that provided by the top command.
So, I'm trying to figure out what I am missing? What else do I need to add to this equation to get the total memory usage in my application.
memory-management java-8 jvm
Tomer
source share