Switch -MD[x]<size>[k,m,g] - select the dictionary size


Sliding dictionary is the memory area used by compression algorithm to find and compress repeated data patterns. If size of file to compress, or total files size in case of solid archive, is larger than dictionary size, increasing the dictionary is likely to increase the compression ratio, reduce the archiving speed and increase memory requirements.

For RAR 5.0 archive format the dictionary size can be: 128 KB, 256 KB, 512 KB, 1 MB, 2 MB, 4 MB, 8 MB, 16 MB, 32 MB, 64 MB, 128 MB, 256 MB, 512 MB, 1 GB, 2 GB, 4 GB.

WinRAR 7.0 extends the maximum dictionary size up to 64 GB and permits not power of 2 sizes for dictionaries exceeding 4 GB. Such archives can be unpacked by WinRAR 7.0 and newer.

By default, WinRAR refuses to unpack archives with dictionary exceeding 4 GB. It is done to prevent the unexpected large memory allocation. It is possible to change the default limit in Compression settings or use -md<size> or -mdx<size> to allow unpacking dictionaries up to and including the specified size. Unlike -md<size>, -mdx<size> is applied to extraction only and can be added to rar.ini file or RARINISWITCHES environment variable, not affecting archiving commands.

'k', 'm' and 'g' modifiers placed after the size, set kilobyte, megabyte and gigabyte units, like -md64m for 64 MB dictionary. If no modifier is present, megabytes are assumed for -md<size> and gigabytes for -mdx<size> switch, so -md64m and -md64 or -mdx8 and -mdx8g are equal.

Compression memory requirements vary depending on the dictionary size and presence of long range search -mcl switch. Rough estimate is 7x of dictionary size for 1 GB and 1.5x for 64 GB dictionary.

When extracting, slightly more than a single dictionary size is allocated.

If size of all source files for solid archive or size of largest source file for non-solid archive is at least twice less than dictionary size, WinRAR can reduce the dictionary size. It helps to lower memory usage without decreasing compression.

Default sliding dictionary size is 32 MB.

ZIP archives created by WinRAR always use 32 KB dictionary.

Dictionary size can also be selected in Dictionary size list in "Archive name and parameters" dialog.

Example

create a solid archive in RAR 5.0 format with 128 MB dictionary

WinRAR a -s -md128 lib *.dll