コード例 #1
0
 public static void fullGC(boolean verbose) {
   if (verbose)
     System.out.print(
         new Date().toString()
             + ' '
             + String.valueOf((RUNTIME.totalMemory() - RUNTIME.freeMemory()) / 1024L)
             + "Kb used");
   long isFree = RUNTIME.freeMemory();
   long wasFree;
   do {
     wasFree = isFree;
     RUNTIME.runFinalization();
     RUNTIME.gc();
     isFree = RUNTIME.freeMemory();
   } while (isFree > wasFree);
   if (verbose)
     System.out.println(
         " --> "
             + String.valueOf((RUNTIME.totalMemory() - RUNTIME.freeMemory()) / 1024L)
             + "Kb used");
 }
コード例 #2
0
  private void doClean(timerEvent ev) {
    // Cleaner event
    if (VERBOSE) System.err.println("-- Cleaning up packetTable");

    // Might cause some recent packets to be dropped
    packetTable.clear();

    if (VERBOSE) {
      Runtime r = Runtime.getRuntime();
      System.err.println(
          "TOTAL: " + r.totalMemory() / 1024 + "KB FREE: " + r.freeMemory() / 1024 + "KB");
    }

    // Reregister timer event
    timer.registerEvent(CLEAN_TIMER_FREQUENCY, ev, mySink);
  }
コード例 #3
0
ファイル: PerformanceProbe.java プロジェクト: otrack/Batelier
 public String toString() {
   String result = "f=" + (runtime.freeMemory() / MEGA) + "/";
   result += "t=" + (runtime.totalMemory() / MEGA) + "/";
   result += "m=" + (runtime.maxMemory() / MEGA) + "Mb";
   return result;
 }