Java Memory percentMemoryFull()

Here you can find the source of percentMemoryFull()

Description

percent Memory Full

License

Open Source License

Declaration

public static int percentMemoryFull() throws Throwable 

Method Source Code

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

public class Main {
    public static int percentMemoryFull() throws Throwable {
        System.gc();/*from   w  w  w.j a v a 2  s  .  c  om*/

        Runtime r = Runtime.getRuntime();

        double free = r.freeMemory();
        double total = r.totalMemory();
        double used = total - free;

        double percent = used / total;

        return (int) (percent * 100.0);
    }
}

Related

  1. memoryOccupied()
  2. memorySize(long bytesSize)
  3. memoryUtilization()
  4. memoryValue(long inBytes)
  5. normalizeMemoryMeasure(String memory)
  6. removeSliceFromMemory(String schemaName, String cubeName, String loadName)
  7. reportMemory()
  8. reportMemory(double val)
  9. simpleMemory()