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

Keep capacity when unsplit on empty other buf #502

Merged
merged 1 commit into from
Jul 5, 2021

Conversation

Gbillou
Copy link
Contributor

@Gbillou Gbillou commented Jul 5, 2021

When trying to unsplit() from a previous split():

  • if the other buf is not empty the unsplit() results in a buf with the initial capacity
  • if the other buf is empty, other is dropped, capacity lost, and anything new added to the initial buf leads to a reallocation

This changes this second behavior so that even if other is empty the overall capacity is kept.

@Gbillou Gbillou marked this pull request as ready for review July 5, 2021 13:07
Copy link
Contributor

@Darksonn Darksonn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@Darksonn Darksonn merged commit baaf12d into tokio-rs:master Jul 5, 2021
@Darksonn Darksonn mentioned this pull request Aug 25, 2021
lelongg pushed a commit to lelongg/bytes that referenced this pull request Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants