tcacheAllocateSmall() — netty Function Reference
Architecture documentation for the tcacheAllocateSmall() function in PoolArena.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 027331c1_1487_71f3_a618_b8048be0dc49["tcacheAllocateSmall()"] de926ba9_75e3_c416_27fc_3623234991a8["PoolArena"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|defined in| de926ba9_75e3_c416_27fc_3623234991a8 2476a64f_8776_d678_76d8_c4cd7055f5df["allocate()"] 2476a64f_8776_d678_76d8_c4cd7055f5df -->|calls| 027331c1_1487_71f3_a618_b8048be0dc49 1eb7867b_3257_ad29_cda0_1b8484056b67["free()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| 1eb7867b_3257_ad29_cda0_1b8484056b67 a9955d3f_a5f7_e9ad_827d_87d47e26b575["lock()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| a9955d3f_a5f7_e9ad_827d_87d47e26b575 4e98c328_b585_7a56_1218_caff712f9eee["sizeIdx2size()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| 4e98c328_b585_7a56_1218_caff712f9eee 2476a64f_8776_d678_76d8_c4cd7055f5df["allocate()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| 2476a64f_8776_d678_76d8_c4cd7055f5df c24c38bc_94a5_6dd7_1e0a_4abbf00b61e7["unlock()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| c24c38bc_94a5_6dd7_1e0a_4abbf00b61e7 b23f2b6f_d095_a24d_02b5_3cce432b929b["allocateNormal()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| b23f2b6f_d095_a24d_02b5_3cce432b929b c0b7dab6_60ff_7674_6101_0df52eb07a6e["incSmallAllocation()"] 027331c1_1487_71f3_a618_b8048be0dc49 -->|calls| c0b7dab6_60ff_7674_6101_0df52eb07a6e style 027331c1_1487_71f3_a618_b8048be0dc49 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
buffer/src/main/java/io/netty/buffer/PoolArena.java lines 150–189
private void tcacheAllocateSmall(PoolThreadCache cache, PooledByteBuf<T> buf, final int reqCapacity,
final int sizeIdx) {
if (cache.allocateSmall(this, buf, reqCapacity, sizeIdx)) {
// was able to allocate out of the cache so move on
return;
}
/*
* Synchronize on the head. This is needed as {@link PoolChunk#allocateSubpage(int)} and
* {@link PoolChunk#free(long)} may modify the doubly linked list as well.
*/
final PoolSubpage<T> head = smallSubpagePools[sizeIdx];
final boolean needsNormalAllocation;
head.lock();
try {
final PoolSubpage<T> s = head.next;
needsNormalAllocation = s == head;
if (!needsNormalAllocation) {
assert s.doNotDestroy && s.elemSize == sizeClass.sizeIdx2size(sizeIdx) : "doNotDestroy=" +
s.doNotDestroy + ", elemSize=" + s.elemSize + ", sizeIdx=" + sizeIdx;
long handle = s.allocate();
assert handle >= 0;
s.chunk.initBufWithSubpage(buf, null, handle, reqCapacity, cache, false);
}
} finally {
head.unlock();
}
if (needsNormalAllocation) {
lock();
try {
allocateNormal(buf, reqCapacity, sizeIdx, cache);
} finally {
unlock();
}
}
incSmallAllocation();
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does tcacheAllocateSmall() do?
tcacheAllocateSmall() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PoolArena.java.
Where is tcacheAllocateSmall() defined?
tcacheAllocateSmall() is defined in buffer/src/main/java/io/netty/buffer/PoolArena.java at line 150.
What does tcacheAllocateSmall() call?
tcacheAllocateSmall() calls 7 function(s): allocate, allocateNormal, free, incSmallAllocation, lock, sizeIdx2size, unlock.
What calls tcacheAllocateSmall()?
tcacheAllocateSmall() is called by 1 function(s): allocate.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free