Changeset 595

Show
Ignore:
Timestamp:
11/12/08 08:18:17 (2 months ago)
Author:
chris
Message:

Perform finalizers more often if heap is low (less than 33% free).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Mika/trunk/core-vm/java/wonka/vm/ProcessMonitor.java

    r528 r595  
    5353   */ 
    5454  public void run() { 
     55    Runtime theRuntime = Runtime.getRuntime(); 
    5556    try { 
    5657      do { 
     
    8687              info.finish(returnvalue);               
    8788            } 
     89            if (theRuntime.freeMemory() < theRuntime.totalMemory() / 3) { 
     90              theRuntime.runFinalization(); 
     91            } 
    8892          } else if (queue.isEmpty()){ 
    8993            wait(10000); 
     
    100104      thread = null; 
    101105    } 
    102     Runtime.getRuntime().runFinalization(); 
     106    theRuntime.runFinalization(); 
    103107    //System.out.println("ProcessMonitor.run() processes = "+processes); 
    104108  }