Fix 7-Zip Insufficient Memory Error When Creating .xz Files

7-zipcompressionmemory

In WinXP 32bit with a Core i5 (dual core) and 4GB RAM, I'm trying to create an .xz archive from a 266MB log file using 7-Zip (GUI) on the "ultra" compression level (method: LZMA2, dictionary size: 48MB, word size: 64, CPU threads: 4/4) with calculated memory for compressing: 1680MB, and for decompressing: 50MB.

This does not work, as I always get an error saying "The system cannot allocate the required amount of memory" regardless of actual memory usage. The 7-Zip FAQ mentions a 2GB restriction on allocated virtual space, but the given "memory for compression" is well under that limit.

Does anyone know what's going on?

Best Answer

A 32 Bit process (on a 32 Bit Windows) has 2GB address space. BUT: That space will be fragmented! There is the code, some DLLs, and your data (and ...), all with some rater large gaps in between.

If the 1680 MB needs to be a single block, it is rather unlikely that there is so much address space free: Allocation fails. This happens regularly if one single requested block is bigger than about 1 GB. In other words: You cannot allocate one single 1GB block, but you could maybe one 700 MB and one with 300 MB.

There is the "vmmap" tool in the sysinternals suite, which you can use to display the address layout of a process, including free space.

Related Question