<div style='background-color: none transparent;'></div>
Home » » Get Free Memory of Java Virtual Machine(JVM) Example

Get Free Memory of Java Virtual Machine(JVM) Example

/*
Get Free Memory of Java Virtual Machine(JVM) Example
This Java example shows how to get amount of free memory
in the Java Virtual Machine(JVM) using freeMemory method
of Java Runtime class.
*/
public class GetFreeMemory {

public static void main(String args[])
{
/*
* get current Java Runtime using getRuntime()
* method of Runtime class.
*/
Runtime runtime = Runtime.getRuntime();

/*
* To determine amount of free memory available to current
* Java Virtual Machine(JVM), use
*
* long freeMemory()
* method of Runtime class.
*/

long freeMemory = runtime.freeMemory();

System.out.println(freeMemory + " bytes free in JVM");
}


}

/*
Typical output would be
4993048 bytes free in JVM
*/
Share this article :
 
Copyright © 2011. B.Sc B.Tech MCA Ploytechnic Mini,Main Projects | Free Main Projcets Download | MCA |B.tech . All Rights Reserved
Company Info | Contact Us | Privacy policy | Term of use | Widget | Advertise with Us | Site map
Template Modify by Creating Website. Inpire by Darkmatter Rockettheme Proudly powered by Blogger