Module stormpot

Class PreciseLeakDetector

java.lang.Object
stormpot.internal.PreciseLeakDetector

public final class PreciseLeakDetector extends Object
Leak detector, used to detect if objects allocated by the pool get garbage collected, without first being deallocated by the pool.
  • Constructor Details

    • PreciseLeakDetector

      public PreciseLeakDetector()
      Create a new instance.
  • Method Details

    • register

      public void register(BSlot<?> slot)
      Register the given slot and its contained object with the detector.

      The slot has had an object allocated to it, and is about to be handed over to user code.

      Parameters:
      slot - The slot to register.
    • unregister

      public void unregister(BSlot<?> slot)
      Deregister the given slot from the leak detector.

      The object held by the slot has been deallocated by the pool.

      Parameters:
      slot - The slot to deregister.
    • countLeakedObjects

      public long countLeakedObjects()
      Compute a count of the leaked objects that this detector has detected.
      Returns:
      The number of object leaks observed.