Java Memory Free getFreeMemory()

Here you can find the source of getFreeMemory()

Description

get Free Memory

License

Open Source License

Declaration

public static long getFreeMemory() 

Method Source Code

//package com.java2s;
/*/*from   w  w  w  .ja va 2 s .c  om*/
 * $Id$
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

public class Main {
    private static Runtime runtime = Runtime.getRuntime();
    private static long lastMemoryReading = 0;

    public static long getFreeMemory() {
        lastMemoryReading = runtime.freeMemory();
        return lastMemoryReading;
    }
}

Related

  1. freeMemoryPercents()
  2. freeReserveMemory()
  3. getFreeJVMMemoryMB()
  4. getFreeLiveMemory()
  5. getFreeMemory()
  6. getFreeMemory()
  7. getFreeMemory(boolean preRunGarbageCollector)
  8. getFreeMemoryForAppInKB()
  9. getFreeMemoryInMb()