class_docstr: A TestCase which runs tests multiple times, collecting reference counts.
code: def run(self, result=None):
      # python_message.py registers all Message classes to some pickle global
      # registry, which makes the classes immortal.
      # We save a copy of this registry, and reset it before we could references.
      self._saved_pickle_registry = copyreg.dispatch_table.copy()
  
      # Run the test twice, to warm up the instance attributes.
      super(ReferenceLeakCheckerTestCase, self).run(result=result)
      super(ReferenceLeakCheckerTestCase, self).run(result=result)
  
      oldrefcount = 0
      local_result = LocalTestResult(result)
  
      refcount_deltas = []
      for _ in range(self.NB_RUNS):
          oldrefcount = self._getRefcounts()
          super(ReferenceLeakCheckerTestCase, self).run(
              result=local_result
          )
          newrefcount = self._getRefcounts()
          refcount_deltas.append(newrefcount - oldrefcount)
      print(refcount_deltas, self)
  
      try:
          self.assertEqual(refcount_deltas, [0] * self.NB_RUNS)
      except Exception:  # pylint: disable=broad-except
          result.addError(self, sys.exc_info())
  
file_path: coremltools/deps/protobuf/python/google/protobuf/internal/testing_refleaks.py
imports: import gc
  import sys
label_desc: Use image node_id 1 for calling the ReferenceLeakCheckerTestCase obj's underlying member method code with example usage: obj.run(result) without return types