From 1d3d193561c3816748b4d3b08ab6194ca3200fb9 Mon Sep 17 00:00:00 2001 From: Daan Date: Mon, 10 Feb 2025 20:37:01 -0800 Subject: [PATCH 1/2] make heap_main mi_decl_hidden --- src/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/init.c b/src/init.c index 7cef8eea..1643d3fe 100644 --- a/src/init.c +++ b/src/init.c @@ -99,7 +99,7 @@ const mi_page_t _mi_page_empty = { // may lead to allocation itself on some platforms) // -------------------------------------------------------- -mi_decl_cache_align const mi_heap_t _mi_heap_empty = { +mi_decl_hidden mi_decl_cache_align const mi_heap_t _mi_heap_empty = { NULL, MI_ATOMIC_VAR_INIT(NULL), 0, // tid @@ -127,7 +127,7 @@ mi_threadid_t _mi_thread_id(void) mi_attr_noexcept { // the thread-local default heap for allocation mi_decl_thread mi_heap_t* _mi_heap_default = (mi_heap_t*)&_mi_heap_empty; -extern mi_heap_t _mi_heap_main; +extern mi_decl_hidden mi_heap_t _mi_heap_main; static mi_decl_cache_align mi_subproc_t mi_subproc_default; From 78dd3f0e38b47a4a7cc9b123600482a660ff5f0c Mon Sep 17 00:00:00 2001 From: Daan Date: Mon, 10 Feb 2025 20:55:30 -0800 Subject: [PATCH 2/2] add mi_is_redirected back (issue #993) --- src/init.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/init.c b/src/init.c index 1643d3fe..03201707 100644 --- a/src/init.c +++ b/src/init.c @@ -561,6 +561,11 @@ bool mi_decl_noinline _mi_preloading(void) { return os_preloading; } +// Returns true if mimalloc was redirected +mi_decl_nodiscard bool mi_is_redirected(void) mi_attr_noexcept { + return _mi_is_redirected(); +} + // Called once by the process loader from `src/prim/prim.c` void _mi_process_load(void) { mi_heap_main_init();