Skip to content

optimize number of buffer allocations #11879

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

Merged
merged 16 commits into from
Feb 14, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix OkHttpWritableBufferAllocatorTest
  • Loading branch information
panchenko committed Feb 8, 2025
commit 40b7fc7ba17bc4f7db36fec3c174bc9b05f56f59
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.grpc.internal.WritableBuffer;
import io.grpc.internal.WritableBufferAllocator;
import io.grpc.internal.WritableBufferAllocatorTestBase;
import okio.Segment;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
Expand All @@ -42,7 +43,7 @@ protected WritableBufferAllocator allocator() {
public void testCapacity() {
WritableBuffer buffer = allocator().allocate(4096);
assertEquals(0, buffer.readableBytes());
assertEquals(4096, buffer.writableBytes());
assertEquals(Segment.SIZE, buffer.writableBytes());
}

@Test
Expand All @@ -56,6 +57,6 @@ public void testInitialCapacityHasMaximum() {
public void testIsExactBelowMaxCapacity() {
WritableBuffer buffer = allocator().allocate(4097);
assertEquals(0, buffer.readableBytes());
assertEquals(4097, buffer.writableBytes());
assertEquals(Segment.SIZE, buffer.writableBytes());
}
}
Loading