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) #32

Open
KoalaBear84 opened this issue Jun 7, 2024 · 1 comment
Open

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

KoalaBear84 opened this issue Jun 7, 2024 · 1 comment

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");

// This is the fix
IReadOnlyDictionary<ZSTD_dParameter, int> advancedParams = new Dictionary<ZSTD_dParameter, int>([
    new KeyValuePair<ZSTD_dParameter, int>(ZSTD_dParameter.ZSTD_d_windowLogMax, 31)
]);

DecompressionOptions decompressionOptions = new(null, advancedParams);
await using var decompressionStream = new DecompressionStream(fileStreamInput, decompressionOptions);
await decompressionStream.CopyToAsync(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:
oleg-st/ZstdSharp#37

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

1 participant