Home / Function/ testUsedDirectMemory() — netty Function Reference

testUsedDirectMemory() — netty Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  1267f842_fd0c_2eb6_4ff1_b6b119a959e5["testUsedDirectMemory()"]
  b5780ec9_74a4_594b_4225_0099765d71e7["AdaptiveByteBufAllocatorTest"]
  1267f842_fd0c_2eb6_4ff1_b6b119a959e5 -->|defined in| b5780ec9_74a4_594b_4225_0099765d71e7
  efbe94da_0929_2626_e102_bdd8e91c281e["expectedUsedMemory()"]
  1267f842_fd0c_2eb6_4ff1_b6b119a959e5 -->|calls| efbe94da_0929_2626_e102_bdd8e91c281e
  style 1267f842_fd0c_2eb6_4ff1_b6b119a959e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java lines 88–107

    @Override
    @Test
    public void testUsedDirectMemory() {
        AdaptiveByteBufAllocator allocator =  newAllocator(true);
        ByteBufAllocatorMetric metric = 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();
        // This is a new size class, and a new magazine with a new chunk
        assertEquals(2 * expectedUsedMemory(allocator, capacity), metric.usedDirectMemory(), buffer.toString());

        buffer.release();
        // Memory is still held by the magazines
        assertEquals(2 * expectedUsedMemory(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/AdaptiveByteBufAllocatorTest.java.
Where is testUsedDirectMemory() defined?
testUsedDirectMemory() is defined in buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java at line 88.
What does testUsedDirectMemory() call?
testUsedDirectMemory() calls 1 function(s): expectedUsedMemory.

Analyze Your Own Codebase

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

Try Supermodel Free