Home / Function/ testUsedDirectMemory() — netty Function Reference

testUsedDirectMemory() — netty Function Reference

Architecture documentation for the testUsedDirectMemory() function in AbstractByteBufAllocatorTest.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  e10fe3d2_1745_fdb4_78ac_e6a561b91625["testUsedDirectMemory()"]
  7ff0721a_af2d_e20c_7c69_b0b95f85fcac["AbstractByteBufAllocatorTest"]
  e10fe3d2_1745_fdb4_78ac_e6a561b91625 -->|defined in| 7ff0721a_af2d_e20c_7c69_b0b95f85fcac
  e2d9218f_d9b1_045c_899a_af37dc01f3a2["expectedUsedMemory()"]
  e10fe3d2_1745_fdb4_78ac_e6a561b91625 -->|calls| e2d9218f_d9b1_045c_899a_af37dc01f3a2
  49f82fa0_2cff_4f13_42f1_efa99057f7ce["expectedUsedMemoryAfterRelease()"]
  e10fe3d2_1745_fdb4_78ac_e6a561b91625 -->|calls| 49f82fa0_2cff_4f13_42f1_efa99057f7ce
  style e10fe3d2_1745_fdb4_78ac_e6a561b91625 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AbstractByteBufAllocatorTest.java lines 131–147

    @Test
    public void testUsedDirectMemory() {
        T allocator =  newAllocator(true);
        ByteBufAllocatorMetric metric = ((ByteBufAllocatorMetricProvider) allocator).metric();
        assertEquals(0, metric.usedDirectMemory());
        ByteBuf buffer = allocator.directBuffer(1024, 4096);
        int capacity = buffer.capacity();
        assertEquals(expectedUsedMemory(allocator, capacity), metric.usedDirectMemory());

        // Double the size of the buffer
        buffer.capacity(capacity << 1);
        capacity = buffer.capacity();
        assertEquals(expectedUsedMemory(allocator, capacity), metric.usedDirectMemory(), buffer.toString());

        buffer.release();
        assertEquals(expectedUsedMemoryAfterRelease(allocator, capacity), metric.usedDirectMemory());
    }

Domain

Subdomains

Frequently Asked Questions

What does testUsedDirectMemory() do?
testUsedDirectMemory() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufAllocatorTest.java.
Where is testUsedDirectMemory() defined?
testUsedDirectMemory() is defined in buffer/src/test/java/io/netty/buffer/AbstractByteBufAllocatorTest.java at line 131.
What does testUsedDirectMemory() call?
testUsedDirectMemory() calls 2 function(s): expectedUsedMemory, expectedUsedMemoryAfterRelease.

Analyze Your Own Codebase

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

Try Supermodel Free