Skip to content

Commit

Permalink
Correctly set capacity of remainder in DefaultDataBuffer::split
Browse files Browse the repository at this point in the history
This commit ensures that the capacity of the remainder buffer after a
split operation is set directly on the field. Calling capacity(int)
caused a new buffer to be allocated.

See gh-31848
Closes gh-31859
  • Loading branch information
poutsma committed Dec 18, 2023
1 parent bafff50 commit b272f4e
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public DataBuffer split(int index) {
.slice();
this.writePosition = Math.max(this.writePosition, index) - index;
this.readPosition = Math.max(this.readPosition, index) - index;
capacity(this.byteBuffer.capacity());
this.capacity = this.byteBuffer.capacity();

return result;
}
Expand Down

0 comments on commit b272f4e

Please sign in to comment.