Returns the free JVM Heap Size - Java Java Virtual Machine

Java examples for Java Virtual Machine:Memory

Description

Returns the free JVM Heap Size

Demo Code


//package com.java2s;

public class Main {
    /**/*  w  ww .  j a  v  a 2s . com*/
     * Returns the free JVM Heap Size
     * 
     * @return Free JVM Heap Size in a human readable unit
     */
    public static Long getFreeHeapSize() {
        return Runtime.getRuntime().freeMemory();
    }
}

Related Tutorials