code: private static void startAllocCounting() {
          // Before we start trigger a GC and reset the debug counts. Run the
          // finalizers and another GC before starting and stopping the alloc
          // counts. This will free up any objects that were just sitting around
          // waiting for their finalizers to be run.
          Runtime.getRuntime().gc();
          Runtime.getRuntime().runFinalization();
          Runtime.getRuntime().gc();
  
          Debug.resetAllCounts();
  
          // start the counts
          Debug.startAllocCounting();
      }
docs: /*
  Starts allocation counting. This triggers a gc and resets the counts.