Getting memory usages of JVM using java
by guruprasad[ Edit ] 2014-05-14 19:02:53
To Get the memory usages of a Java Virtual Machine(JVM), follow the steps:
function to be used:
long freeMemory = Runtime.getRuntime().freeMemory();
long totalMemory = Runtime.getRuntime().totalMemory();
long maxMemory = Runtime.getRuntime().maxMemory();
It will differ on various executions,
Note:Useful in knowing the usage of memory on loop executions and so on