Java Memory Free isFreeMemoryAvailable()

Here you can find the source of isFreeMemoryAvailable()

Description

is Free Memory Available

License

Apache License

Declaration

public static boolean isFreeMemoryAvailable() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean isFreeMemoryAvailable() {
        Runtime runtime = Runtime.getRuntime();
        long maxMemory = runtime.maxMemory();
        long totalFree = runtime.freeMemory() + maxMemory - runtime.totalMemory();
        return totalFree > maxMemory * 0.2;
    }//  w w  w  . j av  a 2 s . co  m
}

Related

  1. getMemoryFree()
  2. getMemoryFree()
  3. getSystemFreeMemory()
  4. getTilesBasedOnFreeMemory(int rows, int cols)
  5. hasFreeMemory(float margin)
  6. jvmFreeMemory(String size, Boolean txtByte)
  7. memoryFree()
  8. memoryFree()
  9. sampleFreeMemory()