Intro
This tutorials, will show how to get free memory of JVM. To get free memory of JVM, you should use the Runtime class.
Examples
package com.freesamplecode.java.basic; public class GetFreeMemoryJVMDemo { public static void main(String[] args){ Runtime runtime = Runtime.getRuntime(); long freeMemory = runtime.freeMemory(); System.out.println("Free memory in JVM is : "+freeMemory +" byte"); } }
Output
Free memory in JVM is : 121587520 byte
0 comments: