Home / Class/ AllocConfig Class — netty Architecture

AllocConfig Class — netty Architecture

Architecture documentation for the AllocConfig class in AllocationPatternSimulator.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565["AllocConfig"]
  c9fb080e_e943_3d97_be1a_c8039258e2c5["AllocationPatternSimulator.java"]
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565 -->|defined in| c9fb080e_e943_3d97_be1a_c8039258e2c5
  99f6cde3_0ee5_22d5_f91f_0a12e1561207["AllocConfig()"]
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565 -->|method| 99f6cde3_0ee5_22d5_f91f_0a12e1561207
  0f78878b_2de1_dd50_8561_ea417592c5e3["Thread()"]
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565 -->|method| 0f78878b_2de1_dd50_8561_ea417592c5e3
  bf2c887c_0e83_62ec_db0a_3fd73c2c9951["usedMemory()"]
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565 -->|method| bf2c887c_0e83_62ec_db0a_3fd73c2c9951
  6ce25a60_6fad_0130_1f22_85aeb70b9734["String()"]
  27e61a5f_6c04_1fc0_a0bf_9f0aa035c565 -->|method| 6ce25a60_6fad_0130_1f22_85aeb70b9734

Relationship Graph

Source Code

microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java lines 577–604

    private final class AllocConfig {
        private final AbstractByteBufAllocator allocator;
        private final int avgLiveBufs;
        private final SplittableRandom rng;
        private final String name;

        AllocConfig(boolean isAdaptive, int avgLiveBufs) {
            allocator = isAdaptive ? new AdaptiveByteBufAllocator() : new PooledByteBufAllocator();
            name = String.format(isAdaptive ? "Adaptive (%s)" : "Pooled (%s)", avgLiveBufs);
            this.avgLiveBufs = avgLiveBufs;
            rng = new SplittableRandom(0xBEEFBEEFL);
        }

        Thread start(CountDownLatch startLatch, AtomicBoolean stopCondition) {
            return new Workload(startLatch, allocator, rng.split(), stopCondition, avgLiveBufs).start(name);
        }

        long usedMemory() {
            if (allocator instanceof AdaptiveByteBufAllocator) {
                return ((AdaptiveByteBufAllocator) allocator).usedHeapMemory();
            }
            return ((PooledByteBufAllocator) allocator).usedHeapMemory();
        }

        String name() {
            return name;
        }
    }

Frequently Asked Questions

What is the AllocConfig class?
AllocConfig is a class in the netty codebase, defined in microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java.
Where is AllocConfig defined?
AllocConfig is defined in microbench/src/main/java/io/netty/buffer/AllocationPatternSimulator.java at line 577.

Analyze Your Own Codebase

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

Try Supermodel Free