#4748·zstd

cli-tests: levels.sh --max test fails on systems with < 10GB RAM

Author: pratikfarkasestCreated Aug 28, 2026Updated Sep 9, 2026

The compression/levels.sh cli-test unconditionally runs zstd --max on
64-bit systems, which allocates ~8.5GB. This fails on systems with less
than 10GB RAM (e.g. virtual machines, CI containers, embedded test
environments).

The test already handles the 32-bit case by skipping --max:

  if echo "$version_info" | grep -q '32-bit'; then                                                                                                                                 
      # skip --max test: not enough address space                                                                                                                                  
      cp file-19.zst file-max.zst                                                                                                                                                  

A similar check for available memory would allow the rest of the test
(default levels, clamping, environment variables) to run on
memory-constrained systems:

  if echo "$version_info" | grep -q '32-bit' || [ "$(awk '/MemTotal/{print $2}' /proc/meminfo)" -lt 10000000 ]; then                                                               
      # skip --max test: not enough address space or memory (<10GB)                                                                                                                
      cp file-19.zst file-max.zst