Home / Function/ allocate() — netty Function Reference

allocate() — netty Function Reference

Architecture documentation for the allocate() function in PoolThreadCache.java from the netty codebase.

Function java Buffer Search calls 3 called by 1

Entity Profile

Dependency Diagram

graph TD
  a1659e79_8236_9951_f1d0_62b19f3b2ca7["allocate()"]
  a4d6715f_8e89_41fa_05cc_d305ad068060["MemoryRegionCache"]
  a1659e79_8236_9951_f1d0_62b19f3b2ca7 -->|defined in| a4d6715f_8e89_41fa_05cc_d305ad068060
  610ff9ad_3424_2b92_6d1b_26798bcd0ba8["allocate()"]
  610ff9ad_3424_2b92_6d1b_26798bcd0ba8 -->|calls| a1659e79_8236_9951_f1d0_62b19f3b2ca7
  610ff9ad_3424_2b92_6d1b_26798bcd0ba8["allocate()"]
  a1659e79_8236_9951_f1d0_62b19f3b2ca7 -->|calls| 610ff9ad_3424_2b92_6d1b_26798bcd0ba8
  a6dd1dbd_733b_f461_5724_6438bb2d5399["unguardedRecycle()"]
  a1659e79_8236_9951_f1d0_62b19f3b2ca7 -->|calls| a6dd1dbd_733b_f461_5724_6438bb2d5399
  fd5403bf_84dc_665d_0863_1a784edbddd7["initBuf()"]
  a1659e79_8236_9951_f1d0_62b19f3b2ca7 -->|calls| fd5403bf_84dc_665d_0863_1a784edbddd7
  style a1659e79_8236_9951_f1d0_62b19f3b2ca7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PoolThreadCache.java lines 364–375

        public final boolean allocate(PooledByteBuf<T> buf, int reqCapacity, PoolThreadCache threadCache) {
            Entry<T> entry = queue.poll();
            if (entry == null) {
                return false;
            }
            initBuf(entry.chunk, entry.nioBuffer, entry.handle, buf, reqCapacity, threadCache);
            entry.unguardedRecycle();

            // allocations is not thread-safe which is fine as this is only called from the same thread all time.
            ++ allocations;
            return true;
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does allocate() do?
allocate() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PoolThreadCache.java.
Where is allocate() defined?
allocate() is defined in buffer/src/main/java/io/netty/buffer/PoolThreadCache.java at line 364.
What does allocate() call?
allocate() calls 3 function(s): allocate, initBuf, unguardedRecycle.
What calls allocate()?
allocate() 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