BuddyChunk() — netty Function Reference
Architecture documentation for the BuddyChunk() function in AdaptivePoolingAllocator.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD deffd968_35b6_23b3_53db_5f6b8278c6ce["BuddyChunk()"] fbf1f415_2f80_8493_e5fb_f8f9be5f99ee["BuddyChunk"] deffd968_35b6_23b3_53db_5f6b8278c6ce -->|defined in| fbf1f415_2f80_8493_e5fb_f8f9be5f99ee 9e6dbf14_26ff_f501_00e5_f05f951e6c99["Chunk()"] 9e6dbf14_26ff_f501_00e5_f05f951e6c99 -->|calls| deffd968_35b6_23b3_53db_5f6b8278c6ce 0d87a4f6_817c_89dc_baee_630435215d14["capacity()"] deffd968_35b6_23b3_53db_5f6b8278c6ce -->|calls| 0d87a4f6_817c_89dc_baee_630435215d14 style deffd968_35b6_23b3_53db_5f6b8278c6ce fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java lines 1369–1392
BuddyChunk(AbstractByteBuf delegate, Magazine magazine) {
super(delegate, magazine, true);
int capacity = delegate.capacity();
int capFactor = capacity / MIN_BUDDY_SIZE;
int tree = (capFactor << 1) - 1;
int maxShift = Integer.numberOfTrailingZeros(capFactor);
assert maxShift <= 30; // The top 2 bits are used for marking.
freeListCapacity = tree >> 1;
freeList = MpscIntQueue.create(freeListCapacity, -1); // At most half of tree (all leaf nodes) can be freed.
buddies = new byte[1 + tree];
// Generate the buddies entries.
int index = 1;
int runLength = 1;
int currentRun = 0;
while (maxShift > 0) {
buddies[index++] = (byte) maxShift;
if (++currentRun == runLength) {
currentRun = 0;
runLength <<= 1;
maxShift--;
}
}
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does BuddyChunk() do?
BuddyChunk() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java.
Where is BuddyChunk() defined?
BuddyChunk() is defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java at line 1369.
What does BuddyChunk() call?
BuddyChunk() calls 1 function(s): capacity.
What calls BuddyChunk()?
BuddyChunk() is called by 1 function(s): Chunk.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free