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

Max Memory : 934281216

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

Similar Programs Chapter Last Updated
System Time Milliseconds In Java Example Run Time 17-06-2016
File Separator Using System Class Run Time 17-06-2016
Java Virtual Machine (JVM) Termination Example Run Time 17-06-2016
JVM to Run Garbage Collector Example Run Time 17-06-2016
Total Memory Java Virtual Machine (JVM) Example Run Time 17-06-2016
Java RunTime Example Run Time 17-06-2016
Available Processors Using Java Runtime Run Time 06-04-2016
Free Memory In Java Example Run Time 09-07-2016

1