Maximum Memory Available to Java Virtual Machine(JVM)
Chapter:
Run Time
Last Updated:
09-07-2016 05:29:48 UTC
Program:
/* ............... START ............... */
public class JavaMaximumMemory {
public static void main(String args[]) {
Runtime runtime = Runtime.getRuntime();
long maxMemory = runtime.maxMemory();
System.out.println("Max Memory : " + maxMemory);
}
}
/* ............... END ............... */
Output
Notes:
-
The totalMemory() returns how much memory is currently used, while the maxMemory() tells how much can the jvm total allocate.
Tags
Maximum Memory, Java