Java Utililty Methods Memory Max

List of utility methods to do Memory Max

Description

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

Method

booleancheckMaxMemory()
check Max Memory
return Runtime.getRuntime().totalMemory() >= Runtime.getRuntime().maxMemory();
longfreeMaxMemory()
Returns the amount of memory available for use by the Java program.
return maxMemory() - usedMemory();
longgetJavaMaxMemory()
Return maximum amount of memory the JVM will attempt to use
return Runtime.getRuntime().maxMemory();
longgetJvmMaxMemory()
get Jvm Max Memory
return Runtime.getRuntime().maxMemory() / K2M;
intgetMaximumMemory()
Returns the available maximum amount of memory (in MB) this JVM can use.
return Math.round((float) (Runtime.getRuntime().maxMemory() / 1048576L));
longgetMaximumMemory()
get Maximum Memory
long maximumMemory = Runtime.getRuntime().maxMemory();
long totalMemory = Runtime.getRuntime().totalMemory();
if ((maximumMemory <= 0) || (maximumMemory == Long.MAX_VALUE)) {
    maximumMemory = totalMemory;
return maximumMemory;
longgetMaximumMemory()
get Maximum Memory
return Runtime.getRuntime().maxMemory() / 1024 / 1024;
intgetMaximumMemory()
get Maximum Memory
long maxMem = RUNTIME.maxMemory();
if (maxMem > Integer.MAX_VALUE) {
    return Integer.MAX_VALUE;
return (int) maxMem;
longgetMaxMemory()
get Max Memory
return bytesToMegabytes(Runtime.getRuntime().maxMemory());
longgetMaxMemory()
get Max Memory
return Runtime.getRuntime().maxMemory();