Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netty: Removed 4096 min buffer size #11856

Merged
merged 2 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
*/
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.
private static final int MAX_BUFFER = 1024 * 1024;

Expand All @@ -47,7 +44,7 @@ class NettyWritableBufferAllocator implements WritableBufferAllocator {

@Override
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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ protected WritableBufferAllocator allocator() {
return allocator;
}

@Test
public void testCapacityHasMinimum() {
WritableBuffer buffer = allocator().allocate(100);
assertEquals(0, buffer.readableBytes());
assertEquals(4096, buffer.writableBytes());
}

@Test
public void testCapacityIsExactAboveMinimum() {
WritableBuffer buffer = allocator().allocate(9000);
Expand Down