Skip to main content

LZMA_DICT_MEM_LIMIT

Constant LZMA_DICT_MEM_LIMIT 

Source
pub(crate) const LZMA_DICT_MEM_LIMIT: u64 = _ /* 16_777_216u64 */;
Expand description

Memory limit of the LZMA dictionary we are willing to allocate.

Without it, it may lead to an allocation of 4GiB, which is a bit overkill.

Right now, we use 16 MiB, as the spec limits the compression quality to “6”, meaning 9 MiB of decompression memory, which rounds up to 16 MiB in terms of base 2.

From the xz(1) manual page:

Preset   DictSize   CompCPU   CompMem   DecMem
 -0e     256 KiB       8        4 MiB    1 MiB
 -1e       1 MiB       8       13 MiB    2 MiB
 -2e       2 MiB       8       25 MiB    3 MiB
 -3e       4 MiB       7       48 MiB    5 MiB
 -4e       4 MiB       8       48 MiB    5 MiB
 -5e       8 MiB       7       94 MiB    9 MiB
 -6e       8 MiB       8       94 MiB    9 MiB
 -7e      16 MiB       8      186 MiB   17 MiB
 -8e      32 MiB       8      370 MiB   33 MiB
 -9e      64 MiB       8      674 MiB   65 MiB