From 0d559f0c1301af9bd2c6751761bff6490962d0ee Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 4 Aug 2025 21:07:26 +0200 Subject: [PATCH] Increase the initial Boehm GC mark stack size If the mark stack size is too small, it greatly inhibits parallel marking, which is very bad for performance on multi-core systems. --- packaging/dependencies.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packaging/dependencies.nix b/packaging/dependencies.nix index dda9ef8dc..17ba06b4d 100644 --- a/packaging/dependencies.nix +++ b/packaging/dependencies.nix @@ -50,9 +50,19 @@ scope: { requiredSystemFeatures = [ ]; }; - boehmgc = pkgs.boehmgc.override { - enableLargeConfig = true; - }; + boehmgc = + (pkgs.boehmgc.override { + enableLargeConfig = true; + }).overrideAttrs + (attrs: { + # Increase the initial mark stack size to avoid stack + # overflows, since these inhibit parallel marking (see + # GC_mark_some()). To check whether the mark stack is too + # small, run Nix with GC_PRINT_STATS=1 and look for messages + # such as `Mark stack overflow`, `No room to copy back mark + # stack`, and `Grew mark stack to ... frames`. + NIX_CFLAGS_COMPILE = "-DINITIAL_MARK_STACK_SIZE=1048576"; + }); # TODO Hack until https://github.com/NixOS/nixpkgs/issues/45462 is fixed. boost =