The following function is used to compute memory usage.
private static long getMemoryUse(){
putOutTheGarbage();
long totalMemory = Runtime.getRuntime().totalMemory();
putOutTheGarbage();
long freeMemory = Runtime.getRuntime().freeMemory();
return (totalMemory - freeMemory);
}
I do not understand how to understand Runtime.getRuntime().totalMemory()
? In specific, how to understand the relationships connecting Runtime
, getRuntime()
and totalMemory()
?