Java Memory Free getFreeMemory()

Here you can find the source of getFreeMemory()

Description

Returns the free amount of memory (in MB) belonging to JVM.

License

Open Source License

Return

free memory

Declaration

public static int getFreeMemory() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/* ww w .j a  v a2 s . c o  m*/
     * Returns the free amount of memory (in MB) belonging to JVM.
     *
     * @return free memory
     */
    public static int getFreeMemory() {
        return Math.round((float) (Runtime.getRuntime().freeMemory() / 1048576L));
    }
}

Related

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