This wasn't working, because `memlimit_compress` initialized with zero,
thus memory limit is never lowered for 32-bit address space, causing
`Cannot allocate memory' error (in `lzma_outq_init()'). For example,
when `-T0' is used on 32 CPUs with compression level higher than `-6'.

Signed-off-by: Vitaly Chikunov <v...@altlinux.org>
---
 src/xz/hardware.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/xz/hardware.c b/src/xz/hardware.c
index e746cf9..ebe96ce 100644
--- a/src/xz/hardware.c
+++ b/src/xz/hardware.c
@@ -95,8 +95,9 @@ hardware_memlimit_set(uint64_t new_memlimit,
 
                // UINT64_MAX is a special case for the string "max" so
                // that has to be handled specially.
-               if (memlimit_compress != UINT64_MAX
-                               && memlimit_compress > limit_max)
+               if (memlimit_compress == 0 || (
+                               memlimit_compress != UINT64_MAX
+                               && memlimit_compress > limit_max))
                        memlimit_compress = limit_max;
 #endif
        }
-- 
2.29.2


Reply via email to