You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[C++] GZipCodec::Init does deflateInit and immediately throws it away #51308
const Status init_compressor_status = InitCompressor();
if (!init_compressor_status.ok()) {
return init_compressor_status;
}
returnInitDecompressor();
This is wasteful: InitCompressor on line 497 calls deflateInit2, which at windowBits=15 and memLevel=8 allocates roughly 256 KB. InitDecompressor on line 501 calls EndCompressor which does deflateEnd and frees it again. It's pure waste. The only thing it gives us is some validation on the compression level.
The current code leaves the GZipCodec with a valid decompressor (which also allocates, but less) which is fine for the case where the caller wants to use the codec to do decompression, but is extra-wasteful for the case where the caller wants to compress: it allocates a compressor, frees it, allocates a decompressor, frees it, then allocates a compressor again.
I think the correct fix is firebolt-db#47, I'm happy to file it as a PR here as well.
changed the title [-]GZipCodec::Init does deflateInit and immediately throws it away[/-][+][C++] GZipCodec::Init does deflateInit and immediately throws it away[/+]on Sep 11, 2026
Hi @lorenzhs, are you currently planning to open a PR for this upstream, or would you mind if I helped port the lazy initialization fix from firebolt-db#47 to apache/arrow (with you credited as co-author)? Happy to take care of the upstream PR, CI, and test coverage!
Activity
[-]GZipCodec::Init does deflateInit and immediately throws it away[/-][+][C++] GZipCodec::Init does deflateInit and immediately throws it away[/+]La1itchauhan commentedon Sep 22, 2026
Hi @lorenzhs, are you currently planning to open a PR for this upstream, or would you mind if I helped port the lazy initialization fix from firebolt-db#47 to apache/arrow (with you credited as co-author)? Happy to take care of the upstream PR, CI, and test coverage!
lorenzhs commentedon Sep 24, 2026
Lol, no need. I was hoping for a maintainer reaction before opening a PR, I do not need someone to click the button for me.
GH-51308: [C++] Initialize gzip codec state lazily (#51483)
pitrou commentedon Oct 6, 2026
Issue resolved by pull request 51483
#51483