Java Utililty Methods Memory Free

List of utility methods to do Memory Free

Description

The list of methods to do Memory Free are organized into topic(s).

Method

doublegetFreeMemoryInMb()
get Free Memory In Mb
return Runtime.getRuntime().freeMemory() / MB_Numeral;
longgetFreeMemoryKb()
get Free Memory Kb
return kb(Runtime.getRuntime().freeMemory());
longgetFreeMemoryMB()
get Free Memory MB
long freeMemBytes = Runtime.getRuntime().freeMemory();
return freeMemBytes / (1024 * 1024);
longgetJavaFreeMemory()
Return total amount of free memory available to the JVM
return Runtime.getRuntime().freeMemory();
longgetJvmFreeMemory()
get Jvm Free Memory
return Runtime.getRuntime().freeMemory() / K2M;
longgetMemoryFree()
get Memory Free
return Runtime.getRuntime().freeMemory();
intgetMemoryFree()
Get the free memory in KB.
collectGarbage();
Runtime rt = Runtime.getRuntime();
long mem = rt.freeMemory();
return (int) (mem >> 10);
longgetSystemFreeMemory()
get System Free Memory
return Runtime.getRuntime().freeMemory();
int[]getTilesBasedOnFreeMemory(int rows, int cols)
Calculates optimal tile size for the actual free memory.
long freeMemory = Runtime.getRuntime().freeMemory();
int tileSizeY = 256;
int tileSizeX = 256;
if (freeMemory > 8L * cols) {
    tileSizeX = cols;
    tileSizeY = (int) (freeMemory / 8) / cols;
    if (tileSizeY > rows) {
        tileSizeY = rows;
...
booleanhasFreeMemory(float margin)
has Free Memory
return usedMemory() < (1f - margin) * ((float) maxMemory());