|
IsoSurface Rendering of an AR Representation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--rlaramee.Memory
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
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 |
|
Constructor Detail |
public Memory()
Method Detail |
public static void reportMemory()
public static void garbageCollect()
|
IsoSurface Rendering of an AR Representation | |||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |