Skip to content

Commit

Permalink
fix: memory-netty module
Browse files Browse the repository at this point in the history
  • Loading branch information
vibhatha committed Feb 6, 2024
1 parent e55e79e commit 58bc521
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,9 @@ public ArrowBuf empty() {
/**
* The cut-off value for switching allocation strategies.
*/
private final int allocationCutOffValue;

NettyAllocationManager(BufferAllocator accountingAllocator, long requestedSize, int allocationCutOffValue) {
super(accountingAllocator);
this.allocationCutOffValue = allocationCutOffValue;

if (requestedSize > allocationCutOffValue) {
this.memoryChunk = null;
Expand All @@ -92,7 +90,7 @@ public ArrowBuf empty() {
/**
* Get the underlying memory chunk managed by this AllocationManager.
* @return the underlying memory chunk if the request size is not greater than the
* {@link NettyAllocationManager#allocationCutOffValue}, or null otherwise.
* cutoff value provided in the constructor , or null otherwise.
*
* @deprecated this method will be removed in a future release.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public void testNativeEndian() {
final ByteBuf b = NettyArrowBuf.unwrapBuffer(a.buffer(4));
b.setInt(0, 35);
if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
assertEquals(b.getByte(0), 35);
assertEquals(b.getByte(1), 0);
assertEquals(b.getByte(2), 0);
assertEquals(b.getByte(3), 0);
assertEquals(35, b.getByte(0));
assertEquals(0, b.getByte(1));
assertEquals(0, b.getByte(2));
assertEquals(0, b.getByte(3));
} else {
assertEquals(b.getByte(0), 0);
assertEquals(b.getByte(1), 0);
assertEquals(b.getByte(2), 0);
assertEquals(b.getByte(3), 35);
assertEquals(0, b.getByte(0));
assertEquals(0, b.getByte(1));
assertEquals(0, b.getByte(2));
assertEquals(35, b.getByte(3));
}
b.release();
a.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
public class TestNettyAllocator {

@Test
@SuppressWarnings("SynchronizeOnNonFinalField")
public void testMemoryUsage() {
final ListAppender<ILoggingEvent> memoryLogsAppender = new ListAppender<>();
memoryLogsAppender.list = Collections.synchronizedList(memoryLogsAppender.list);
Expand Down

0 comments on commit 58bc521

Please sign in to comment.