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

Deflate compression allocates max buffer size for every operation #258

Closed
CrspyAu opened this issue Nov 28, 2024 · 2 comments
Closed

Deflate compression allocates max buffer size for every operation #258

CrspyAu opened this issue Nov 28, 2024 · 2 comments

Comments

@CrspyAu
Copy link
Contributor

CrspyAu commented Nov 28, 2024

Setting the maxBufferSizeBytes to handle the largest expected operation also allocates that memory for the smallest.

It would be good if the buffer could expand up to the max, rather than be pre-allocated.

Re: #238

@dvsekhvalnov
Copy link
Owner

Hi @CrspyAu , i guess good point.

Probably doable via extending MemoryStream and overriding Capacity property: https://github.com/dotnet/runtime/blob/1d1bf92fcf43aa6981804dc53c5174445069c9e4/src/libraries/System.Private.CoreLib/src/System/IO/MemoryStream.cs#L252

wanna provide proof of concept PR?

@dvsekhvalnov
Copy link
Owner

v5.1.1 released to nuget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants