Monday, August 23, 2010

Java program to Get Heap Size of JVM

Java program to Get Heap Size of JVM 

public class GetHeapSize {
        public static void main(String[]args){
    
            //Get the jvm heap size.
            long heapSize = Runtime.getRuntime().totalMemory();
    
            //Print the jvm heap size.
            System.out.println("Heap Size = " + heapSize);
        }
    }

No comments:

Post a Comment