IsoSurface Rendering of an AR Representation

rlaramee
Class Memory

java.lang.Object
  |
  +--rlaramee.Memory

public class Memory
extends java.lang.Object

Description: This is a memory class used to manage and report the state of the Java VMs memory at runtime.

Some possible useful garbage collection commands gc() and dispose() , System.runFinalization() , and System.gc().

Just before throwing an OutOfMemoryError , Java will automatically invoke the garbage collector to try and free some space. It only throws the exception if the garbage collector was unable to create enough room. So, in general its not necessary to invoke the garbage collector yourself even if you're running low on RAM.

You can find out how much memory your Java app is using with the freeMemory() and totalMemory() methods in the Runtime class. Try this bit of code in your program...

 public void reportMemory()  { 
    Runtime rt = Runtime.getRuntime(); 
    long total = rt.totalMemory(); 
    long free  = rt.freeMemory(); 
    long used  = total - free; 
 

With a little math, you could easily report these values in MBs or KBs

    System.out,println("Used memory: " + used + " bytes"); 
    System.out.println("Free memory: " + free + " bytes");
    System.out.println("Total memory: " + total + " bytes")
 

start date Mon 2 Aug 1999

Version:
1.0
Author:
Robert S Laramee
See Also:

Constructor Summary
Memory()
           
 
Method Summary
static void garbageCollect()
          This method invokes the garbage collector "manually"
static void reportMemory()
           
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

Memory

public Memory()
Method Detail

reportMemory

public static void reportMemory()

garbageCollect

public static void garbageCollect()
This method invokes the garbage collector "manually"

IsoSurface Rendering of an AR Representation