sbcl: fix memory envvar name (#556758)

This commit is contained in:
7c6f434c
2026-08-27 22:45:54 +00:00
committed by GitHub
2 changed files with 8 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
From 6bb8cde826589777e50ddb78e8e1fe7652194a4f Mon Sep 17 00:00:00 2001
From: Hraban Luyat <hraban@0brg.net>
Date: Sat, 13 Apr 2024 14:04:57 -0400
Subject: [PATCH 1/2] feat: SBCL_DYNAMIC_SPACE_SIZE envvar
Subject: [PATCH 1/2] feat: NIX_SBCL_DYNAMIC_SPACE_SIZE envvar
---
src/runtime/runtime.c | 27 +++++++++++++++++++++++++++
@@ -27,14 +27,14 @@ index 295ee2b3c..5c4560f50 100644
+ */
+static void
+read_memsize_from_env(void) {
+ const char *val = getenv("SBCL_DYNAMIC_SPACE_SIZE");
+ const char *val = getenv("NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ // The distinction is blurry between setting an envvar to the empty string and
+ // unsetting it entirely. Depending on the calling environment it can even be
+ // tricky to properly unset an envvar in the first place. An empty envvar is
+ // practically always intended to just mean “unset”, so lets interpret it
+ // that way.
+ if (val != NULL && (strcmp(val, "") != 0)) {
+ dynamic_space_size = parse_size_arg(val, "SBCL_DYNAMIC_SPACE_SIZE");
+ dynamic_space_size = parse_size_arg(val, "NIX_SBCL_DYNAMIC_SPACE_SIZE");
+ }
+}
+

View File

@@ -24,11 +24,11 @@ index 000000000..72ef0cc79
+set -e
+
+# Allow slight shrinkage if heap relocation has to adjust for alignment
+SBCL_DYNAMIC_SPACE_SIZE=234mb run_sbcl_with_args --script <<EOF
+NIX_SBCL_DYNAMIC_SPACE_SIZE=234mb run_sbcl_with_args --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
+SBCL_DYNAMIC_SPACE_SIZE=555mb run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+NIX_SBCL_DYNAMIC_SPACE_SIZE=555mb run_sbcl_with_args --dynamic-space-size 234mb --script <<EOF
+(assert (<= 0 (- (* 234 1024 1024) (sb-ext:dynamic-space-size)) 65536))
+EOF
+
@@ -56,7 +56,7 @@ index faa647e1a..1f2821b5d 100644
echo "::: Success"
+echo "::: Running :DYNAMIC-SPACE-SIZE-ENV-ACCEPT"
+SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --no-userinit --no-sysinit --noprint <<EOF
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 432)
+ (exit :code 42))
+EOF
@@ -66,7 +66,7 @@ index faa647e1a..1f2821b5d 100644
+echo "::: Success"
+
+echo "::: Running :DYNAMIC-SPACE-SIZE-PRECEDENCE"
+SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --dynamic-space-size 333MB \
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"$tmpcore" --dynamic-space-size 333MB \
+ --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 333))
+ (exit :code 42))
@@ -112,7 +112,7 @@ index faa647e1a..1f2821b5d 100644
echo "::: Success"
+echo "::: Running :DYNAMIC-SPACE-SIZE-ENV-IGNORE"
+SBCL_DYNAMIC_SPACE_SIZE=432MB ./"${tmpcore}2" --no-userinit --no-sysinit --noprint <<EOF
+NIX_SBCL_DYNAMIC_SPACE_SIZE=432MB ./"${tmpcore}2" --no-userinit --no-sysinit --noprint <<EOF
+ (when (dynamic-space-size-good-p 260)
+ (exit :code 42))
+EOF