From e318e5bf2d4679f30bf36308621cb10ce4d60725 Mon Sep 17 00:00:00 2001 From: Gabriel Baraldi Date: Thu, 9 Feb 2023 17:54:31 -0300 Subject: [PATCH 1/3] Allow for use 60% of constrained/total system memory --- src/gc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/gc.c b/src/gc.c index 8ca028ed213d5..04bc64082640c 100644 --- a/src/gc.c +++ b/src/gc.c @@ -3254,12 +3254,7 @@ void jl_gc_init(void) total_mem = constrained_mem; #endif - // We allocate with abandon until we get close to the free memory on the machine. - uint64_t free_mem = uv_get_available_memory(); - uint64_t high_water_mark = free_mem / 10 * 7; // 70% high water mark - - if (high_water_mark < max_total_memory) - max_total_memory = high_water_mark; + total_mem = total_mem / 10 * 6; // 60% of constrained memory t_start = jl_hrtime(); } From af1822176a6ec03542d80910f75c514592ca22c9 Mon Sep 17 00:00:00 2001 From: Gabriel Baraldi Date: Thu, 9 Feb 2023 22:14:48 -0300 Subject: [PATCH 2/3] Fix 32 bit --- src/gc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gc.c b/src/gc.c index 04bc64082640c..bee8e1c620d9d 100644 --- a/src/gc.c +++ b/src/gc.c @@ -3246,12 +3246,14 @@ void jl_gc_init(void) gc_num.allocd = 0; gc_num.max_pause = 0; gc_num.max_memory = 0; + total_mem = uv_get_total_memory(); #ifdef _P64 - total_mem = uv_get_total_memory(); uint64_t constrained_mem = uv_get_constrained_memory(); if (constrained_mem > 0 && constrained_mem < total_mem) total_mem = constrained_mem; +#else + total_mem = total_mem > max_total_memory ? max_total_memory : total_mem; #endif total_mem = total_mem / 10 * 6; // 60% of constrained memory From 4a158807cf61f9ca374b6bcfccf921b7d5b62e92 Mon Sep 17 00:00:00 2001 From: Gabriel Baraldi Date: Thu, 9 Feb 2023 22:52:34 -0300 Subject: [PATCH 3/3] Fix 32 bit again? --- src/gc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gc.c b/src/gc.c index bee8e1c620d9d..59cd18e8bd87f 100644 --- a/src/gc.c +++ b/src/gc.c @@ -3246,17 +3246,15 @@ void jl_gc_init(void) gc_num.allocd = 0; gc_num.max_pause = 0; gc_num.max_memory = 0; - total_mem = uv_get_total_memory(); #ifdef _P64 + total_mem = uv_get_total_memory(); uint64_t constrained_mem = uv_get_constrained_memory(); if (constrained_mem > 0 && constrained_mem < total_mem) total_mem = constrained_mem; -#else - total_mem = total_mem > max_total_memory ? max_total_memory : total_mem; + max_total_memory = total_mem / 10 * 6; #endif - total_mem = total_mem / 10 * 6; // 60% of constrained memory t_start = jl_hrtime(); }