Package io.netty.buffer
Class AdaptivePoolingAllocator.BuddyChunk
java.lang.Object
io.netty.buffer.AdaptivePoolingAllocator.Chunk
io.netty.buffer.AdaptivePoolingAllocator.BuddyChunk
- All Implemented Interfaces:
IntConsumer,ReferenceCounted
- Enclosing class:
AdaptivePoolingAllocator
private static final class AdaptivePoolingAllocator.BuddyChunk
extends AdaptivePoolingAllocator.Chunk
implements IntConsumer
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private final MpscIntQueueprivate final intprivate static final byteprivate static final byteprivate static final intprivate static final intprivate static final intprivate static final byteFields inherited from class io.netty.buffer.AdaptivePoolingAllocator.Chunk
allocatedBytes, delegate, magazine -
Constructor Summary
ConstructorsConstructorDescriptionBuddyChunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(int packed) Consume anint.private intchooseFirstFreeBuddy(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.booleanvoidbooleanreadInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int startingCapacity, int maxCapacity) (package private) voidreleaseSegment(int startingIndex, int size) Called when a ByteBuf is done using its allocation in this chunk.inttoString()private booleanunreserveMatchingBuddy(int index, int size, int offset, int currOffset) Un-reserve the matching buddy and return whether there are any other child or sibling reservations.Methods inherited from class io.netty.buffer.AdaptivePoolingAllocator.Chunk
attachToMagazine, capacity, currentMagazine, deallocate, detachFromMagazine, markToDeallocate, refCnt, release, release, releaseFromMagazine, retain, retain, touch, touch
-
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
-
buddies
private final byte[] buddies -
freeListCapacity
private final int freeListCapacity
-
-
Constructor Details
-
BuddyChunk
BuddyChunk(AbstractByteBuf delegate, AdaptivePoolingAllocator.Magazine magazine)
-
-
Method Details
-
readInitInto
public boolean readInitInto(AdaptivePoolingAllocator.AdaptiveByteBuf buf, int size, int startingCapacity, int maxCapacity) - Overrides:
readInitIntoin classAdaptivePoolingAllocator.Chunk
-
accept
public void accept(int packed) Description copied from interface:IntConsumerConsume anint.- Specified by:
acceptin interfaceIntConsumer
-
releaseSegment
void releaseSegment(int startingIndex, int size) Description copied from class:AdaptivePoolingAllocator.ChunkCalled when a ByteBuf is done using its allocation in this chunk.- Overrides:
releaseSegmentin classAdaptivePoolingAllocator.Chunk
-
remainingCapacity
public int remainingCapacity()- Overrides:
remainingCapacityin classAdaptivePoolingAllocator.Chunk
-
hasUnprocessedFreelistEntries
public boolean hasUnprocessedFreelistEntries()- Overrides:
hasUnprocessedFreelistEntriesin classAdaptivePoolingAllocator.Chunk
-
processFreelistEntries
public void processFreelistEntries()- Overrides:
processFreelistEntriesin classAdaptivePoolingAllocator.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
-