From 785f04f9863ed1054f5ecc3d27bc555a22c8c06b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Giraudeau Date: Fri, 7 Jan 2022 15:06:07 +0100 Subject: [PATCH] varnish: use jemalloc instead of glibc's malloc on linux. this is the recommanded default, as glibc cause memory leaks: "We ran into a problem with glibc's malloc on Linux where it seemed like it failed to ever give memory back to the OS, causing the system to swap. We have now switched to jemalloc which appears not to have this problem." (from varnish-cache/doc/changes.rst) --- pkgs/servers/varnish/default.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/servers/varnish/default.nix b/pkgs/servers/varnish/default.nix index 5988c3a211e6..030af847874b 100644 --- a/pkgs/servers/varnish/default.nix +++ b/pkgs/servers/varnish/default.nix @@ -1,5 +1,5 @@ -{ lib, stdenv, fetchurl, fetchpatch, pcre, pcre2, libxslt, groff, ncurses, pkg-config, readline, libedit, coreutils -, python3, makeWrapper }: +{ lib, stdenv, fetchurl, fetchpatch, pcre, pcre2, jemalloc, libxslt, groff, ncurses, pkg-config, readline, libedit +, coreutils, python3, makeWrapper }: let common = { version, sha256, extraNativeBuildInputs ? [] }: @@ -19,7 +19,8 @@ let libxslt groff ncurses readline libedit makeWrapper python3 ] ++ lib.optional (lib.versionOlder version "7") pcre - ++ lib.optional (lib.versionAtLeast version "7") pcre2; + ++ lib.optional (lib.versionAtLeast version "7") pcre2 + ++ lib.optional stdenv.hostPlatform.isLinux jemalloc; buildFlags = [ "localstatedir=/var/spool" ];