private void gc() throws Exception {
  Runtime rt=Runtime.getRuntime();
  long freeMem0=rt.freeMemory();
  long freeMem=Long.MAX_VALUE;
  int cnt=0;
  while (freeMem0 < freeMem && cnt < GC_CALL_CNT) {
    System.gc();
    U.sleep(WAIT_TIME);
    cnt++;
    freeMem=freeMem0;
    freeMem0=rt.freeMemory();
  }
}

private void gc ( ) throws Exception { Runtime rt = Runtime . getRuntime ( ) ; long freeMem0 = rt . freeMemory ( ) ; long freeMem = Long . MAX_VALUE ; int cnt = 0 ; while ( freeMem0 < freeMem && cnt < GC_CALL_CNT ) { System . gc ( ) ; U . sleep ( WAIT_TIME ) ; cnt ++ ; freeMem = freeMem0 ; freeMem0 = rt . freeMemory ( ) ; } }
calls garbage collector and wait .
