Getting memory usages of JVM using java

by guruprasad 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
         

Tagged in:

1090
like
0
dislike
0
mail
flag

You must LOGIN to add comments