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

booleanisFreeMemoryAvailable()
is Free Memory Available
Runtime runtime = Runtime.getRuntime();
long maxMemory = runtime.maxMemory();
long totalFree = runtime.freeMemory() + maxMemory - runtime.totalMemory();
return totalFree > maxMemory * 0.2;
StringjvmFreeMemory(String size, Boolean txtByte)
Obtain JVM's Free Memory.
return convertByteSize(Runtime.getRuntime().freeMemory(), size, txtByte);
longmemoryFree()
memory Free
long mem = 0;
for (int i = 0; i < 10; i++)
    mem += runtime.freeMemory();
mem /= 10;
return mem;
intmemoryFree()
memory Free
Runtime runtime = Runtime.getRuntime();
return Math.round(runtime.freeMemory() / 1024f);
doublesampleFreeMemory()
Get current free memory
The current memory is saved for Memory usage analysis
startMemory = Runtime.getRuntime().freeMemory();
return ConvertByteToMegaByte(startMemory);