From a952a3b8b08a63609172c8c84cf6eb09de9fc7be Mon Sep 17 00:00:00 2001 From: Shirui Cheng Date: Wed, 4 Jun 2025 13:28:37 -0700 Subject: [PATCH] Update the default value for opt_experimental_tcache_gc and opt_calloc_madvise_threshold --- include/jemalloc/internal/jemalloc_internal_types.h | 2 ++ src/jemalloc.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/include/jemalloc/internal/jemalloc_internal_types.h b/include/jemalloc/internal/jemalloc_internal_types.h index 6a81f3cd..cddbfb65 100644 --- a/include/jemalloc/internal/jemalloc_internal_types.h +++ b/include/jemalloc/internal/jemalloc_internal_types.h @@ -145,4 +145,6 @@ typedef enum malloc_init_e malloc_init_t; assert(sizeof(type) * (count) <= VARIABLE_ARRAY_SIZE_MAX); \ VARIABLE_ARRAY_UNSAFE(type, name, count) +#define CALLOC_MADVISE_THRESHOLD_DEFAULT (((size_t)1) << 23) /* 8 MB */ + #endif /* JEMALLOC_INTERNAL_TYPES_H */ diff --git a/src/jemalloc.c b/src/jemalloc.c index a4509e68..c6621a79 100644 --- a/src/jemalloc.c +++ b/src/jemalloc.c @@ -158,7 +158,7 @@ void (*JET_MUTABLE invalid_conf_abort)(void) = &abort; bool opt_utrace = false; bool opt_xmalloc = false; bool opt_experimental_infallible_new = false; -bool opt_experimental_tcache_gc = false; +bool opt_experimental_tcache_gc = true; bool opt_zero = false; unsigned opt_narenas = 0; static fxp_t opt_narenas_ratio = FXP_INIT_INT(4); @@ -168,7 +168,8 @@ unsigned ncpus; unsigned opt_debug_double_free_max_scan = SAFETY_CHECK_DOUBLE_FREE_MAX_SCAN_DEFAULT; -size_t opt_calloc_madvise_threshold = 0; +size_t opt_calloc_madvise_threshold = + CALLOC_MADVISE_THRESHOLD_DEFAULT; /* Protects arenas initialization. */ static malloc_mutex_t arenas_lock;