FiV0 opened a new issue, #141:
URL: https://github.com/apache/arrow-java/issues/141

   ### Describe the bug, including details regarding any error messages, 
version, and platform.
   
   The following snippet
   ```java
   package org.apache.arrow.vector;
   
   import org.apache.arrow.memory.ArrowBuf;
   import org.apache.arrow.memory.RootAllocator;
   import org.junit.jupiter.api.Test;
   
   
   public class BufferAllocatorOverAllocation {
   
       @Test
       void overallocation()  {
           RootAllocator allocator = new RootAllocator();
           ArrowBuf buf = allocator.buffer(9946);
   
           System.out.println(buf.capacity());
   
           buf.capacity(9946);
   
           System.out.println(buf.capacity());
   
       }
   
   }
   ```
   prints
   ```
   16384
   9946
   ```
   So without setting the capacity explicitly the allocator overallocates 
memory and also seems to set the capacity of the buffer to that. That is 
contrary to the docstring of the `buffer` method:
   ```
   Note that the buffer may technically be larger than the requested size for 
rounding purposes. However, the buffer's capacity will be set to the configured 
size.
   ```
   
   Tested against the `14.0.2` tag. 
   
   
   ### Component(s)
   
   Java


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to