On Tue, Aug 18, 2026 at 3:48 PM Anthonin Bonnefoy <[email protected]> wrote: > I'm a bit surprised by the 1.3MB estimation, how did you find this > amount? If I check with ZSTD_sizeof_CCtx just after the context is > created, I have: > (gdb) p ZSTD_sizeof_CCtx(zstd_cctx) > $1 = 5288 > > After being used once, it seems to stay stable with: > (gdb) p ZSTD_sizeof_CCtx(zstd_cctx) > $5 = 154261 > So it looks closer to 152KB. > > + if (zstd_cctx == NULL) > + zstd_cctx = ZSTD_createCCtx();
On a second look, 1.3MB is the size reported by ZSTD_estimateCCtxSize with the default compression level for the worst case. So it's the maximum memory a cctx can use, and my test was probably not enough to reach this.
