Interface RmmEventHandler


public interface RmmEventHandler
  • Method Summary

    Modifier and Type
    Method
    Description
    long[]
    Get the memory thresholds that will trigger onAllocThreshold(long) to be called when one or more of the thresholds is crossed during a memory allocation.
    long[]
    Get the memory thresholds that will trigger onDeallocThreshold(long) to be called when one or more of the thresholds is crossed during a memory deallocation.
    default void
    onAllocated(long size)
    Invoked after every memory allocation when debug mode is enabled.
    default boolean
    onAllocFailure(long sizeRequested)
    Deprecated.
    deprecated in favor of onAllocFailure(long, boolean)
    default boolean
    onAllocFailure(long sizeRequested, int retryCount)
    Invoked on a memory allocation failure.
    void
    onAllocThreshold(long totalAllocSize)
    Invoked after an RMM memory allocate operation when an allocate threshold is crossed.
    default void
    onDeallocated(long size)
    Invoked after every memory deallocation when debug mode is enabled.
    void
    onDeallocThreshold(long totalAllocSize)
    Invoked after an RMM memory deallocation operation when a deallocate threshold is crossed.
  • Method Details

    • onAllocFailure

      default boolean onAllocFailure(long sizeRequested)
      Deprecated.
      deprecated in favor of onAllocFailure(long, boolean)
      Invoked on a memory allocation failure.
      Parameters:
      sizeRequested - number of bytes that failed to allocate
      Returns:
      true if the memory allocation should be retried or false if it should fail
    • onAllocated

      default void onAllocated(long size)
      Invoked after every memory allocation when debug mode is enabled.
      Parameters:
      size - number of bytes allocated
    • onDeallocated

      default void onDeallocated(long size)
      Invoked after every memory deallocation when debug mode is enabled.
      Parameters:
      size - number of bytes deallocated
    • onAllocFailure

      default boolean onAllocFailure(long sizeRequested, int retryCount)
      Invoked on a memory allocation failure.
      Parameters:
      sizeRequested - number of bytes that failed to allocate
      retryCount - number of times this allocation has been retried after failure
      Returns:
      true if the memory allocation should be retried or false if it should fail
    • getAllocThresholds

      long[] getAllocThresholds()
      Get the memory thresholds that will trigger onAllocThreshold(long) to be called when one or more of the thresholds is crossed during a memory allocation. A threshold is crossed when the total memory allocated before the RMM allocate operation is less than a threshold value and the threshold value is less than or equal to the total memory allocated after the RMM memory allocate operation.
      Returns:
      allocate memory thresholds or null for no thresholds.
    • getDeallocThresholds

      long[] getDeallocThresholds()
      Get the memory thresholds that will trigger onDeallocThreshold(long) to be called when one or more of the thresholds is crossed during a memory deallocation. A threshold is crossed when the total memory allocated before the RMM deallocate operation is greater than or equal to a threshold value and the threshold value is greater than the total memory allocated after the RMM memory deallocate operation.
      Returns:
      deallocate memory thresholds or null for no thresholds.
    • onAllocThreshold

      void onAllocThreshold(long totalAllocSize)
      Invoked after an RMM memory allocate operation when an allocate threshold is crossed. See getAllocThresholds() for details on allocate threshold crossing.

      NOTE: Any exception thrown by this method will cause the corresponding allocation that triggered the threshold callback to be released before the exception is propagated to the application.

      Parameters:
      totalAllocSize - total amount of memory allocated after the crossing
    • onDeallocThreshold

      void onDeallocThreshold(long totalAllocSize)
      Invoked after an RMM memory deallocation operation when a deallocate threshold is crossed. See getDeallocThresholds() for details on deallocate threshold crossing.

      NOTE: Any exception thrown by this method will be propagated to the application after the resource that triggered the threshold was released.

      Parameters:
      totalAllocSize - total amount of memory allocated after the crossing