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

Java examples for Java Virtual Machine:Utility

Description

Get Total Memory of Java Virtual Machine(JVM)

Demo Code

public class Main {
 
        public static void main(String args[])
        {//from w  w  w . ja  va  2  s .c om
                Runtime runtime = Runtime.getRuntime();
                long totalMemory = runtime.totalMemory();
                System.out.println(totalMemory + " bytes total in JVM");
        }
}

Result


Related Tutorials