Class AdaptivePoolingAllocator.BuddyChunk

java.lang.Object
io.netty.buffer.AdaptivePoolingAllocator.Chunk
io.netty.buffer.AdaptivePoolingAllocator.BuddyChunk
All Implemented Interfaces:
ChunkInfo, java.util.function.IntConsumer
Enclosing class:
AdaptivePoolingAllocator

private static final class AdaptivePoolingAllocator.BuddyChunk extends AdaptivePoolingAllocator.Chunk implements java.util.function.IntConsumer
  • Field Details

    • MIN_BUDDY_SIZE

      private static final int MIN_BUDDY_SIZE
      See Also:
    • IS_CLAIMED

      private static final byte IS_CLAIMED
      See Also:
    • HAS_CLAIMED_CHILDREN

      private static final byte HAS_CLAIMED_CHILDREN
      See Also:
    • SHIFT_MASK

      private static final byte SHIFT_MASK
      See Also:
    • PACK_OFFSET_MASK

      private static final int PACK_OFFSET_MASK
      See Also:
    • PACK_SIZE_SHIFT

      private static final int PACK_SIZE_SHIFT
    • freeList

      private final MpscIntQueue freeList
    • buddies

      private final byte[] buddies
    • freeListCapacity

      private final int freeListCapacity
  • Constructor Details

  • Method Details

    • readInitInto

      public boolean readInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int startingCapacity, int maxCapacity)
      Overrides:
      readInitInto in class AdaptivePoolingAllocator.Chunk
    • accept

      public void accept(int packed)
      Specified by:
      accept in interface java.util.function.IntConsumer
    • unpackSize

      private static int unpackSize(int packed)
    • unpackOffset

      private static int unpackOffset(int packed)
    • releaseSegment

      void releaseSegment(int startingIndex, int size)
      Description copied from class: AdaptivePoolingAllocator.Chunk
      Called when a ByteBuf is done using its allocation in this chunk.
      Overrides:
      releaseSegment in class AdaptivePoolingAllocator.Chunk
    • remainingCapacity

      public int remainingCapacity()
      Overrides:
      remainingCapacity in class AdaptivePoolingAllocator.Chunk
    • hasUnprocessedFreelistEntries

      public boolean hasUnprocessedFreelistEntries()
      Overrides:
      hasUnprocessedFreelistEntries in class AdaptivePoolingAllocator.Chunk
    • processFreelistEntries

      public void processFreelistEntries()
      Overrides:
      processFreelistEntries in class AdaptivePoolingAllocator.Chunk
    • chooseFirstFreeBuddy

      private int chooseFirstFreeBuddy(int index, int size, int currOffset)
      Claim a suitable buddy and return its start offset into the delegate chunk, or return -1 if nothing claimed.
    • unreserveMatchingBuddy

      private boolean unreserveMatchingBuddy(int index, int size, int offset, int currOffset)
      Un-reserve the matching buddy and return whether there are any other child or sibling reservations.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object