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

Frame requires too much memory for decoding (+ fix) #37

Closed
KoalaBear84 opened this issue Jun 7, 2024 · 4 comments
Closed

Frame requires too much memory for decoding (+ fix) #37

KoalaBear84 opened this issue Jun 7, 2024 · 4 comments

Comments

@KoalaBear84
Copy link

I've had some issues with decompression a single file, other went fine.

My fix was the following:

using FileStream fileStreamInput = File.OpenRead("TheInputPath");
using FileStream fileStreamOutput = File.OpenWrite("TheOutputPath");

using var decompressionStream = new DecompressionStream(fileStreamInput);
// This is the fix
decompressionStream.SetParameter(ZstdSharp.Unsafe.ZSTD_dParameter.ZSTD_d_windowLogMax, 31);
decompressionStream.CopyTo(fileStreamOutput);

Took the 31 from this ZSTD_WINDOWLOG_MAX_64:
https://github.com/facebook/zstd/blob/v1.4.5/lib/zstd.h#L1049

I have no idea what it all means, but I hope it helps someone stuck with the same issue 😃

@KoalaBear84
Copy link
Author

Cross posted solution to other lib:
skbkontur/ZstdNet#32

@oleg-st
Copy link
Owner

oleg-st commented Jun 7, 2024

This seems to work as it should. See https://facebook.github.io/zstd/zstd_manual.html#Chapter6 for a description of the ZSTD_d_windowLogMax parameter.

@KoalaBear84
Copy link
Author

I don't say that anything is wrong 😅 Only issue it wasn't working and I had no idea, found a solution and wanted to let it know for others 😇

Ahh, powers of 2, that makes sense why it's only 31 and not the real amount bytes. 👍

@oleg-st
Copy link
Owner

oleg-st commented Jun 7, 2024

Okay, thank you.

@oleg-st oleg-st closed this as completed Jun 7, 2024
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