Sunday, March 1, 2009

code runtime class methods



package funds;

public class RuntimeDemo {
public static void main(String arg[])
{
Runtime r=Runtime.getRuntime();
System.out.println(r.totalMemory());
System.out.println(r.freeMemory());
for(int i=0; i<100;i++)
{
java.util.Date d=new java.util.Date();
d=null;
}
System.out.println(r.freeMemory());
r.gc();
System.out.println(r.freeMemory());
}
}
output:
2031616
1877944
1877944
1933320



0 comments:

Post a Comment