Exemplo n.º 1
0
 public static void logGarbageCollections()
 {
     info("Max GC generation = " + GC.MaxGeneration);
     new Thread(() => {
         var lastCount       = GC.CollectionCount(2);
         var lastTotalMemory = GC.GetTotalMemory(false);
         while (O.produce(() => true))
         {
             var newTotalMemory = GC.GetTotalMemory(false);
             if (lastCount == GC.CollectionCount(2))
             {
                 continue;
             }
             lastCount = GC.CollectionCount(2);
             info("garbage collected " + lastCount + ", memory diff = " + (lastTotalMemory - newTotalMemory));
             lastTotalMemory = newTotalMemory;
         }
     }).Start();
 }