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

Open
CrspyAu opened this issue Nov 28, 2024 · 1 comment
Open

Deflate compression allocates max buffer size for every operation #258

CrspyAu opened this issue Nov 28, 2024 · 1 comment

Comments

@CrspyAu
Copy link

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?

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

No branches or pull requests

2 participants