Showing posts with label jvm. Show all posts
Showing posts with label jvm. Show all posts

How to get amount of free memory in jvm ???

***********************************************************
COMPLETE SOURCE CODE FOR : FreeMemoryInJvm.java
***********************************************************


public class FreeMemoryInJvm
{
public static void main(String[]args)
{
System.out.println("Free Memory In Jvm is : "+Runtime.getRuntime().freeMemory()+" bytes");
}
}


***********************************************************
JUST COMPILE AND EXECUTE IT
***********************************************************

How to know maximum amount of memory that will be use by jvm ???

******************************************************
COMPLETE SOURCE CODE FOR : MaxMemoryThatJvmWillUse.java
******************************************************


public class MaxMemoryThatJvmWillUse
{
public static void main(String[]args)
{
System.out.println("Max Amount Of Memory That Will Be Use By Jvm is : "+Runtime.getRuntime().maxMemory()+ " bytes");
}
}


******************************************************
JUST COMPILE AND EXECUTE IT
******************************************************

How to get total memory in jvm ???

*********************************************************
COMPLETE SOURCE CODE FOR : GetTotalMemoryInJvm.java
*********************************************************


public class GetTotalMemoryInJvm
{
public static void main(String[]args)
{
//Print total memory in java virtual machine in bytes
System.out.println("TOTAL MEMORY IN JVM : "+Runtime.getRuntime().totalMemory());
}
}


*********************************************************
JUST COMPILE AND EXECUTE IT
*********************************************************

RELAXING NATURE VIDEO