Home / Function/ allocateWithoutLock() — netty Function Reference

allocateWithoutLock() — netty Function Reference

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

Function java Buffer Telemetry calls 7 called by 1

Entity Profile

Dependency Diagram

graph TD
  2845f5ec_6a60_22de_f8d4_345bc5446f42["allocateWithoutLock()"]
  03ccb368_d6fc_bee6_64d5_0e674ae8c01f["Magazine"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|defined in| 03ccb368_d6fc_bee6_64d5_0e674ae8c01f
  4a58da3c_40d1_32f5_6976_57fdd64dc888["tryAllocate()"]
  4a58da3c_40d1_32f5_6976_57fdd64dc888 -->|calls| 2845f5ec_6a60_22de_f8d4_345bc5446f42
  0a745cad_53b5_e976_8e80_cfe56a86673e["restoreMagazineFreed()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| 0a745cad_53b5_e976_8e80_cfe56a86673e
  9d31fc3c_9011_6bf1_391a_b0388f8c5e8d["attachToMagazine()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| 9d31fc3c_9011_6bf1_391a_b0388f8c5e8d
  33bb02aa_95f4_9821_7021_dcda1b551bd1["transferToNextInLineOrRelease()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| 33bb02aa_95f4_9821_7021_dcda1b551bd1
  f4981826_99f5_bf62_b6e7_eb825c46476a["releaseFromMagazine()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| f4981826_99f5_bf62_b6e7_eb825c46476a
  4c60941e_e0a0_70ab_d9ff_1197fdd8f8d6["computeBufferCapacity()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| 4c60941e_e0a0_70ab_d9ff_1197fdd8f8d6
  aa355cc9_0be7_7204_fd7f_51edca001d83["remainingCapacity()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| aa355cc9_0be7_7204_fd7f_51edca001d83
  5b606370_5e08_94d5_b745_9c0ce73ce25a["readInitInto()"]
  2845f5ec_6a60_22de_f8d4_345bc5446f42 -->|calls| 5b606370_5e08_94d5_b745_9c0ce73ce25a
  style 2845f5ec_6a60_22de_f8d4_345bc5446f42 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java lines 862–896

        private boolean allocateWithoutLock(int size, int maxCapacity, AdaptiveByteBuf buf) {
            Chunk curr = NEXT_IN_LINE.getAndSet(this, null);
            if (curr == MAGAZINE_FREED) {
                // Allocation raced with a stripe-resize that freed this magazine.
                restoreMagazineFreed();
                return false;
            }
            if (curr == null) {
                curr = group.pollChunk(size);
                if (curr == null) {
                    return false;
                }
                curr.attachToMagazine(this);
            }
            boolean allocated = false;
            int remainingCapacity = curr.remainingCapacity();
            int startingCapacity = chunkController.computeBufferCapacity(
                    size, maxCapacity, true /* never update stats as we don't hold the magazine lock */);
            if (remainingCapacity >= size &&
                    curr.readInitInto(buf, size, Math.min(remainingCapacity, startingCapacity), maxCapacity)) {
                allocated = true;
                remainingCapacity = curr.remainingCapacity();
            }
            try {
                if (remainingCapacity >= RETIRE_CAPACITY) {
                    transferToNextInLineOrRelease(curr);
                    curr = null;
                }
            } finally {
                if (curr != null) {
                    curr.releaseFromMagazine();
                }
            }
            return allocated;
        }

Domain

Subdomains

Called By

Frequently Asked Questions

What does allocateWithoutLock() do?
allocateWithoutLock() is a function in the netty codebase, defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java.
Where is allocateWithoutLock() defined?
allocateWithoutLock() is defined in buffer/src/main/java/io/netty/buffer/AdaptivePoolingAllocator.java at line 862.
What does allocateWithoutLock() call?
allocateWithoutLock() calls 7 function(s): attachToMagazine, computeBufferCapacity, readInitInto, releaseFromMagazine, remainingCapacity, restoreMagazineFreed, transferToNextInLineOrRelease.
What calls allocateWithoutLock()?
allocateWithoutLock() is called by 1 function(s): tryAllocate.

Analyze Your Own Codebase

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

Try Supermodel Free