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

Add support for shrinking massive ByteBufferBIOs #443

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

Lukasa
Copy link
Contributor

@Lukasa Lukasa commented Sep 12, 2023

Motivation:

ByteBufferBIOs will grow their outbound buffer until flush is called. They will retain their capacity at however large it got to avoid reallocating, as they assume that your write pattern will be fairly consistent.

In some cases this is a bad strategy, because it overcommits data. To allow users to reclaim this data, we can add a configuration option that will shrink the playload on the next write.

Modifications:

  • Added support for ByteBufferBIO to shrink the payload.
  • Plumbed up support for handler configuration.
  • Tests that shrinkage actually works.

Result:

Users can reclaim memory.

Motivation:

ByteBufferBIOs will grow their outbound buffer until flush is
called. They will retain their capacity at however large it got
to avoid reallocating, as they assume that your write pattern will
be fairly consistent.

In some cases this is a bad strategy, because it overcommits data.
To allow users to reclaim this data, we can add a configuration
option that will shrink the playload on the next write.

Modifications:

- Added support for ByteBufferBIO to shrink the payload.
- Plumbed up support for handler configuration.
- Tests that shrinkage actually works.

Result:

Users can reclaim memory.
@Lukasa Lukasa added the 🔼 needs-minor-version-bump For PRs that when merge cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Sep 12, 2023
@Lukasa Lukasa merged commit 7aabfa3 into apple:main Sep 18, 2023
8 checks passed
@Lukasa Lukasa deleted the cb-reclaim-bio branch September 18, 2023 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merge cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants