diff --git a/pkgs/applications/science/math/sage/sage-tests.nix b/pkgs/applications/science/math/sage/sage-tests.nix index 591fa192d56..0cd5b5d976a 100644 --- a/pkgs/applications/science/math/sage/sage-tests.nix +++ b/pkgs/applications/science/math/sage/sage-tests.nix @@ -51,6 +51,10 @@ stdenv.mkDerivation rec { export HOME="$TMPDIR/sage-home" mkdir -p "$HOME" + # avoid running out of memory with many threads in subprocesses, see + # https://github.com/NixOS/nixpkgs/pull/65802 + export GLIBC_TUNABLES=glibc.malloc.arena_max=4 + echo "Running sage tests with arguments ${timeSpecifier} ${patienceSpecifier} ${testArgs}" "sage" -t --nthreads "$NIX_BUILD_CORES" --optional=sage ${timeSpecifier} ${patienceSpecifier} ${testArgs} '';