public void prepareForNextRun(){
  for (int i=0; i < 5; i++) {
    System.gc();
    try {
      Thread.sleep(20);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
  }
}

public void prepareForNextRun ( ) { for ( int i = 0 ; i < 5 ; i ++ ) { System . gc ( ) ; try { Thread . sleep ( 20 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } } }
try to give gc some time to settle down .
