Home / Function/ allocate() — netty Function Reference

allocate() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  18042f3d_b641_22b7_d7b2_aba6c8edf02c["allocate()"]
  ad035c77_35f5_72ad_c059_f20a84e5fef2["PoolChunkList"]
  18042f3d_b641_22b7_d7b2_aba6c8edf02c -->|defined in| ad035c77_35f5_72ad_c059_f20a84e5fef2
  82c98989_ce91_11bf_56b1_649038858a55["remove()"]
  18042f3d_b641_22b7_d7b2_aba6c8edf02c -->|calls| 82c98989_ce91_11bf_56b1_649038858a55
  91139286_a1fc_610b_22e4_6610a6b11791["add()"]
  18042f3d_b641_22b7_d7b2_aba6c8edf02c -->|calls| 91139286_a1fc_610b_22e4_6610a6b11791
  style 18042f3d_b641_22b7_d7b2_aba6c8edf02c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/PoolChunkList.java lines 99–117

    boolean allocate(PooledByteBuf<T> buf, int reqCapacity, int sizeIdx, PoolThreadCache threadCache) {
        int normCapacity = arena.sizeClass.sizeIdx2size(sizeIdx);
        if (normCapacity > maxCapacity) {
            // Either this PoolChunkList is empty or the requested capacity is larger then the capacity which can
            // be handled by the PoolChunks that are contained in this PoolChunkList.
            return false;
        }

        for (PoolChunk<T> cur = head; cur != null; cur = cur.next) {
            if (cur.allocate(buf, reqCapacity, sizeIdx, threadCache)) {
                if (cur.freeBytes <= freeMinThreshold) {
                    remove(cur);
                    nextList.add(cur);
                }
                return true;
            }
        }
        return false;
    }

Domain

Subdomains

Frequently Asked Questions

What does allocate() do?
allocate() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/PoolChunkList.java.
Where is allocate() defined?
allocate() is defined in buffer/src/main/java/io/netty/buffer/PoolChunkList.java at line 99.
What does allocate() call?
allocate() calls 2 function(s): add, remove.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free