Home / Function/ tryAllocate() — netty Function Reference

tryAllocate() — netty Function Reference

Architecture documentation for the tryAllocate() function in AdaptivePoolingAllocator.java from the netty codebase.

Function java Buffer Telemetry calls 2 called by 1

Entity Profile

Dependency Diagram

graph TD
  4a58da3c_40d1_32f5_6976_57fdd64dc888["tryAllocate()"]
  03ccb368_d6fc_bee6_64d5_0e674ae8c01f["Magazine"]
  4a58da3c_40d1_32f5_6976_57fdd64dc888 -->|defined in| 03ccb368_d6fc_bee6_64d5_0e674ae8c01f
  080309e4_d57c_ce66_6f51_f105cc6f6710["AdaptiveByteBuf()"]
  080309e4_d57c_ce66_6f51_f105cc6f6710 -->|calls| 4a58da3c_40d1_32f5_6976_57fdd64dc888
  b550a3a7_b98a_e36b_d58d_413aa6587ed4["allocate()"]
  4a58da3c_40d1_32f5_6976_57fdd64dc888 -->|calls| b550a3a7_b98a_e36b_d58d_413aa6587ed4
  2845f5ec_6a60_22de_f8d4_345bc5446f42["allocateWithoutLock()"]
  4a58da3c_40d1_32f5_6976_57fdd64dc888 -->|calls| 2845f5ec_6a60_22de_f8d4_345bc5446f42
  style 4a58da3c_40d1_32f5_6976_57fdd64dc888 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java lines 844–860

        public boolean tryAllocate(int size, int maxCapacity, AdaptiveByteBuf buf, boolean reallocate) {
            if (allocationLock == null) {
                // This magazine is not shared across threads, just allocate directly.
                return allocate(size, maxCapacity, buf, reallocate);
            }

            // Try to retrieve the lock and if successful allocate.
            long writeLock = allocationLock.tryWriteLock();
            if (writeLock != 0) {
                try {
                    return allocate(size, maxCapacity, buf, reallocate);
                } finally {
                    allocationLock.unlockWrite(writeLock);
                }
            }
            return allocateWithoutLock(size, maxCapacity, buf);
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does tryAllocate() do?
tryAllocate() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java.
Where is tryAllocate() defined?
tryAllocate() is defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java at line 844.
What does tryAllocate() call?
tryAllocate() calls 2 function(s): allocate, allocateWithoutLock.
What calls tryAllocate()?
tryAllocate() is called by 1 function(s): AdaptiveByteBuf.

Analyze Your Own Codebase

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

Try Supermodel Free