Start Search Contents Index Links About
ShowMemInfo.java
/*
 * Author: Havard Rast Blok
 * E-mail:  
 * Web   : www.rememberjava.com
 */

/**
 * Shows some memory information about the VM.
 */
public class ShowMemInfo
{
  public static void main(String[] args)
  {
    Runtime r;
    long free, max, total;
    
    r = Runtime.getRuntime();
    free = r.freeMemory();
    max = r.maxMemory();
    total = r.totalMemory();
    
    System.out.println("Free memory  : "+free);
    System.out.println("Max memory   : "+max);
    System.out.println("Total memory : "+total);
    
  }
}


site: Håvard Rast Blok
mail:
updated: 27 July 2007