Get Free Memory of Java Virtual Machine(JVM) - Java Java Virtual Machine

Java examples for Java Virtual Machine:Utility

Description

Get Free Memory of Java Virtual Machine(JVM)

Demo Code

public class Main {
 
        public static void main(String args[])
        {//  w  ww . j  a va  2s . com
                Runtime runtime = Runtime.getRuntime();
                long freeMemory = runtime.freeMemory();
                 
                System.out.println(freeMemory + " bytes free in JVM");
        }
}

Result


Related Tutorials