netty: Removed 4096 min buffer size (#11856)

* netty: Removed 4096 min buffer size
This commit is contained in:
Abhishek Agrawal 2025-01-30 12:52:37 +05:30 committed by GitHub
parent b3db8c2489
commit 7153ff8522
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 1 additions and 11 deletions

View File

@ -33,9 +33,6 @@ import io.netty.buffer.ByteBufAllocator;
*/ */
class NettyWritableBufferAllocator implements WritableBufferAllocator { class NettyWritableBufferAllocator implements WritableBufferAllocator {
// Use 4k as our minimum buffer size.
private static final int MIN_BUFFER = 4 * 1024;
// Set the maximum buffer size to 1MB. // Set the maximum buffer size to 1MB.
private static final int MAX_BUFFER = 1024 * 1024; private static final int MAX_BUFFER = 1024 * 1024;
@ -47,7 +44,7 @@ class NettyWritableBufferAllocator implements WritableBufferAllocator {
@Override @Override
public WritableBuffer allocate(int capacityHint) { public WritableBuffer allocate(int capacityHint) {
capacityHint = Math.min(MAX_BUFFER, Math.max(MIN_BUFFER, capacityHint)); capacityHint = Math.min(MAX_BUFFER, capacityHint);
return new NettyWritableBuffer(allocator.buffer(capacityHint, capacityHint)); return new NettyWritableBuffer(allocator.buffer(capacityHint, capacityHint));
} }
} }

View File

@ -40,13 +40,6 @@ public class NettyWritableBufferAllocatorTest extends WritableBufferAllocatorTes
return allocator; return allocator;
} }
@Test
public void testCapacityHasMinimum() {
WritableBuffer buffer = allocator().allocate(100);
assertEquals(0, buffer.readableBytes());
assertEquals(4096, buffer.writableBytes());
}
@Test @Test
public void testCapacityIsExactAboveMinimum() { public void testCapacityIsExactAboveMinimum() {
WritableBuffer buffer = allocator().allocate(9000); WritableBuffer buffer = allocator().allocate(9000);