This is an automated email from the ASF dual-hosted git repository.

jbonofre pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-java.git


The following commit(s) were added to refs/heads/main by this push:
     new aaf68b43f GH-238: Stop TestNettyAllocator wrapping Netty's empty 
buffer in a 1024-byte ArrowBuf (#1427)
aaf68b43f is described below

commit aaf68b43ffd7f4f41643833de851ef8cc8550912
Author: JB Onofré <[email protected]>
AuthorDate: Sun Nov 1 06:26:29 2026 +0000

    GH-238: Stop TestNettyAllocator wrapping Netty's empty buffer in a 
1024-byte ArrowBuf (#1427)
    
    ## What's Changed
    
    `TestNettyAllocator.testMemoryUsage` wrapped a 1024-byte `NO_OP`
    `ArrowBuf` around the memory address of `PooledByteBufAllocatorL`'s
    empty buffer, whose native allocation is only a few bytes. The test only
    reads `memoryAddress()` today, so nothing overruns yet, but any read or
    write through that buffer would run past the end of the native
    allocation. That's the same problem #1426 fixes in `TestEmptyArrowBuf`.
    
    The buffer isn't needed. The memory usage log the test waits for comes
    from the status thread that the `PooledByteBufAllocatorL` constructor
    starts when TRACE logging is enabled, so the test now constructs the
    allocator directly and drops the `ArrowBuf`.
    
    All `memory-netty` tests pass locally on JDK 21 with Error Prone
    enabled.
    
    Closes #238.
---
 .../org/apache/arrow/memory/netty/TestNettyAllocator.java    | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git 
a/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
 
b/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
index 5be42ecb0..ffbec4127 100644
--- 
a/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
+++ 
b/memory/memory-netty/src/test/java/org/apache/arrow/memory/netty/TestNettyAllocator.java
@@ -25,8 +25,6 @@ import ch.qos.logback.core.read.ListAppender;
 import io.netty.buffer.PooledByteBufAllocatorL;
 import java.util.Collections;
 import java.util.stream.Collectors;
-import org.apache.arrow.memory.ArrowBuf;
-import org.apache.arrow.memory.ReferenceManager;
 import org.junit.jupiter.api.Test;
 import org.slf4j.LoggerFactory;
 
@@ -43,14 +41,8 @@ public class TestNettyAllocator {
       logger.setLevel(Level.TRACE);
       logger.addAppender(memoryLogsAppender);
       memoryLogsAppender.start();
-      try (ArrowBuf buf =
-          new ArrowBuf(
-              ReferenceManager.NO_OP,
-              null,
-              1024,
-              new PooledByteBufAllocatorL().empty.memoryAddress())) {
-        buf.memoryAddress();
-      }
+      // Creating the allocator with TRACE logging enabled starts the thread 
that logs memory usage.
+      new PooledByteBufAllocatorL();
       boolean result = false;
       long startTime = System.currentTimeMillis();
       while ((System.currentTimeMillis() - startTime)

Reply via email to