diff options
author | Lasse Collin <lasse.collin@tukaani.org> | 2022-04-14 14:50:17 +0300 |
---|---|---|
committer | Lasse Collin <lasse.collin@tukaani.org> | 2022-04-14 14:50:17 +0300 |
commit | 1d592897278b172d8549aa29c3a1f3a4f432a9b9 (patch) | |
tree | 5250e0fba76c89106e6d680999273f53f1a3e123 /src/xz/hardware.c | |
parent | xz: Add a default soft memory usage limit for --threads=0. (diff) | |
download | xz-1d592897278b172d8549aa29c3a1f3a4f432a9b9.tar.xz |
xz: Change the cap of the default -T0 memlimit for 32-bit xz.
The SIZE_MAX / 3 was 1365 MiB. 1400 MiB gives little more room
and it looks like a round (artificial) number in --info-memory
once --info-memory is made to display it.
Also, using #if avoids useless code on 64-bit builds.
Diffstat (limited to 'src/xz/hardware.c')
-rw-r--r-- | src/xz/hardware.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/xz/hardware.c b/src/xz/hardware.c index 2cc3f4f2..3d10edc9 100644 --- a/src/xz/hardware.c +++ b/src/xz/hardware.c @@ -279,15 +279,17 @@ hardware_init(void) // /proc/meminfo as the starting point. memlimit_mt_default = total_ram / 4; +#if SIZE_MAX == UINT32_MAX // A too high value may cause 32-bit xz to run out of address space. // Use a conservative maximum value here. A few typical address space // sizes with Linux: // - x86-64 with 32-bit xz: 4 GiB // - x86: 3 GiB // - MIPS32: 2 GiB - const size_t mem_ceiling = SIZE_MAX / 3; // About 1365 GiB on 32-bit + const size_t mem_ceiling = 1400U << 20; if (memlimit_mt_default > mem_ceiling) memlimit_mt_default = mem_ceiling; +#endif return; } |