Hi all, As discussed in the ticket and on IRC, the default maximum heap size is *not* to kill processes early to prevent programs from running amok, but as a way to avoid allocating more than our C_word pointers can address with the masked out bits.
Therefore, the value on 64-bit platforms is not correct - it is 2GB there, which is the 32-bit limit. Attached is a signed-off copy of Dieggsy's trivial patch with a change in the NEWS file to point this out to users as this may be an important change for people relying on this limit for other reasons. Cheers, Peter
From d6cc3d958c6f73a1bc7adaa89a3c71c7d0394b11 Mon Sep 17 00:00:00 2001 From: dieggsy <[email protected]> Date: Sat, 10 Apr 2021 13:36:18 -0400 Subject: [PATCH] Increase maximum heap size on 64-bit machines Signed-off-by: Peter Bex <[email protected]> --- NEWS | 3 +++ runtime.c | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c5eb0f03..b283d436 100644 --- a/NEWS +++ b/NEWS @@ -35,6 +35,9 @@ contributed by Sebastien Marie) - A feature corresponding to the word size is available regardless of the word size (#1693) + - The default maximum heap size on 64-bit platforms is now the + theoretical maximum addressable memory size (#1675). Use -:m + if you would like to override this at run-time. - Deprecated C_(a_i_current_)milliseconds in favor of C_(a_i_)current_process_milliseconds to match the Scheme-level deprecation of current-milliseconds. diff --git a/runtime.c b/runtime.c index 51cfa7be..dfc2e0ee 100644 --- a/runtime.c +++ b/runtime.c @@ -150,8 +150,10 @@ static C_TLS int timezone; #ifdef C_SIXTY_FOUR # define DEFAULT_STACK_SIZE (1024 * 1024) +# define DEFAULT_MAXIMAL_HEAP_SIZE 0x7ffffffffffffff0 #else # define DEFAULT_STACK_SIZE (256 * 1024) +# define DEFAULT_MAXIMAL_HEAP_SIZE 0x7ffffff0 #endif #define DEFAULT_SYMBOL_TABLE_SIZE 2999 @@ -159,7 +161,6 @@ static C_TLS int timezone; #define DEFAULT_HEAP_SIZE DEFAULT_STACK_SIZE #define MINIMAL_HEAP_SIZE DEFAULT_STACK_SIZE #define DEFAULT_SCRATCH_SPACE_SIZE 256 -#define DEFAULT_MAXIMAL_HEAP_SIZE 0x7ffffff0 #define DEFAULT_HEAP_GROWTH 200 #define DEFAULT_HEAP_SHRINKAGE 50 #define DEFAULT_HEAP_SHRINKAGE_USED 25 -- 2.20.1
signature.asc
Description: PGP signature
