From bbe81101db67b02c97037b1a1b5c17c688aee6f8 Mon Sep 17 00:00:00 2001 From: daanx Date: Sun, 5 Jan 2025 11:12:27 -0800 Subject: [PATCH 1/3] add comment --- include/mimalloc/types.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/mimalloc/types.h b/include/mimalloc/types.h index 1d3c7b07..e45da9a7 100644 --- a/include/mimalloc/types.h +++ b/include/mimalloc/types.h @@ -99,7 +99,8 @@ terms of the MIT license. A copy of the license can be found in the file #define MI_ENCODE_FREELIST 1 #endif -// Enable large pages for objects between 128KiB and 512KiB. Disabled by default. +// Enable large pages for objects between 64KiB and 256KiB. +// Disabled by default as for many workloads the block sizes above 64 KiB are quite random which can lead to too many partially used large pages. #ifndef MI_ENABLE_LARGE_PAGES #define MI_ENABLE_LARGE_PAGES 0 #endif From bd3392466b151767ad449f82007091d693e685ae Mon Sep 17 00:00:00 2001 From: daanx Date: Sun, 5 Jan 2025 11:39:42 -0800 Subject: [PATCH 2/3] remove mi_debug_show_arenas parameter --- include/mimalloc.h | 2 +- src/arena.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/mimalloc.h b/include/mimalloc.h index 281f5ead..10695def 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -276,7 +276,7 @@ mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size mi_decl_export int mi_reserve_os_memory(size_t size, bool commit, bool allow_large) mi_attr_noexcept; mi_decl_export bool mi_manage_os_memory(void* start, size_t size, bool is_committed, bool is_pinned /* cannot decommit/reset? */, bool is_zero, int numa_node) mi_attr_noexcept; -mi_decl_export void mi_debug_show_arenas(bool show_pages, bool narrow) mi_attr_noexcept; +mi_decl_export void mi_debug_show_arenas(void) mi_attr_noexcept; // Experimental: heaps associated with specific memory arena's typedef void* mi_arena_id_t; diff --git a/src/arena.c b/src/arena.c index 55b6fb9b..f7e7b44a 100644 --- a/src/arena.c +++ b/src/arena.c @@ -1438,7 +1438,7 @@ static size_t mi_debug_show_bitmap_binned(const char* header1, const char* heade return mi_debug_show_chunks(header1, header2, header3, slice_count, mi_bitmap_chunk_count(bitmap), &bitmap->chunks[0], chunk_bins, invert, arena, narrow); } -void mi_debug_show_arenas(bool show_pages, bool narrow) mi_attr_noexcept { +static void mi_debug_show_arenas_ex(bool show_pages, bool narrow) mi_attr_noexcept { mi_subproc_t* subproc = _mi_subproc(); size_t max_arenas = mi_arenas_get_count(subproc); //size_t free_total = 0; @@ -1473,6 +1473,10 @@ void mi_debug_show_arenas(bool show_pages, bool narrow) mi_attr_noexcept { if (show_pages) _mi_output_message("total pages in arenas: %zu\n", page_total); } +void mi_debug_show_arenas(void) mi_attr_noexcept { + mi_debug_show_arenas_ex(true /* show pages */, false /* narrow? */); +} + /* ----------------------------------------------------------- Reserve a huge page arena. From aa8e8ab58d30a30558071caf41ee3b25529bc56c Mon Sep 17 00:00:00 2001 From: daanx Date: Sun, 5 Jan 2025 11:42:17 -0800 Subject: [PATCH 3/3] remove mi_debug_show_arenas parameter --- include/mimalloc.h | 2 +- src/arena.c | 3 ++- test/test-stress.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/mimalloc.h b/include/mimalloc.h index 6d9eb4fc..ec6dabc6 100644 --- a/include/mimalloc.h +++ b/include/mimalloc.h @@ -276,7 +276,7 @@ mi_decl_export int mi_reserve_huge_os_pages_at(size_t pages, int numa_node, size mi_decl_export int mi_reserve_os_memory(size_t size, bool commit, bool allow_large) mi_attr_noexcept; mi_decl_export bool mi_manage_os_memory(void* start, size_t size, bool is_committed, bool is_large, bool is_zero, int numa_node) mi_attr_noexcept; -mi_decl_export void mi_debug_show_arenas(bool show_inuse) mi_attr_noexcept; +mi_decl_export void mi_debug_show_arenas(void) mi_attr_noexcept; // Experimental: heaps associated with specific memory arena's typedef int mi_arena_id_t; diff --git a/src/arena.c b/src/arena.c index ce08d601..a97299ee 100644 --- a/src/arena.c +++ b/src/arena.c @@ -923,7 +923,8 @@ static size_t mi_debug_show_bitmap(const char* prefix, const char* header, size_ return inuse_count; } -void mi_debug_show_arenas(bool show_inuse) mi_attr_noexcept { +void mi_debug_show_arenas(void) mi_attr_noexcept { + const bool show_inuse = true; size_t max_arenas = mi_atomic_load_relaxed(&mi_arena_count); size_t inuse_total = 0; //size_t abandoned_total = 0; diff --git a/test/test-stress.c b/test/test-stress.c index 8c5fca9c..dc7f9cb0 100644 --- a/test/test-stress.c +++ b/test/test-stress.c @@ -316,7 +316,7 @@ int main(int argc, char** argv) { #ifndef USE_STD_MALLOC #ifndef NDEBUG - mi_debug_show_arenas(true); + mi_debug_show_arenas(); mi_collect(true); #endif #endif