Home / Function/ testUsedHeapMemory() — netty Function Reference

testUsedHeapMemory() — netty Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java lines 109–128

    @Override
    @Test
    public void testUsedHeapMemory() {
        AdaptiveByteBufAllocator allocator =  newAllocator(true);
        ByteBufAllocatorMetric metric = allocator.metric();
        assertEquals(0, metric.usedHeapMemory());
        ByteBuf buffer = allocator.heapBuffer(1024, 4096);
        int capacity = buffer.capacity();
        assertEquals(expectedUsedMemory(allocator, capacity), metric.usedHeapMemory());

        // 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.usedHeapMemory(), buffer.toString());

        buffer.release();
        // Memory is still held by the magazines
        assertEquals(2 * expectedUsedMemory(allocator, capacity), metric.usedHeapMemory());
    }

Domain

Subdomains

Frequently Asked Questions

What does testUsedHeapMemory() do?
testUsedHeapMemory() is a function in the netty codebase, defined in buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java.
Where is testUsedHeapMemory() defined?
testUsedHeapMemory() is defined in buffer/src/test/java/io/netty/buffer/AdaptiveByteBufAllocatorTest.java at line 109.
What does testUsedHeapMemory() call?
testUsedHeapMemory() 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