-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Labels
Description
zstd 1.5.2 doesn't reduce the Windows Size from 2 GiB to 1 GiB, if file size is exactly 1 GiB.
To Reproduce
FSUtil File CreateNew 1024 0x40000000
zstd --long=31 -1 --single-thread --no-content-size -f 1024
zstd -l -v 1024.zst
result:
Window Size: 2.00 GiB (2147483648 B)
Expected behavior
Window Size: 1.00 GiB
Source code lines
the bug probably in function ZSTD_adjustCParams_internal()
in zstd_compress.c
:
const U64 maxWindowResize = 1ULL << (ZSTD_WINDOWLOG_MAX-1);
...
/* resize windowLog if input is small enough, to use less memory */
if ( (srcSize < maxWindowResize)
and fixed version probably must use <=
instead of <
:
if ( (srcSize <= maxWindowResize)
Cyan4973 and miyurus-xino