mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-06 23:39:31 +03:00
Merge branch 'dev3' into dev3-bin
This commit is contained in:
commit
86952f6d1b
4 changed files with 11 additions and 5 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -304,10 +304,11 @@ int main(int argc, char** argv) {
|
|||
#endif
|
||||
#if !defined(NDEBUG) && !defined(USE_STD_MALLOC)
|
||||
mi_option_set(mi_option_arena_reserve, 32 * 1024 /* in kib = 32MiB */);
|
||||
//mi_option_set(mi_option_purge_delay,10);
|
||||
mi_option_set(mi_option_purge_delay,1);
|
||||
#endif
|
||||
#if defined(NDEBUG) && !defined(USE_STD_MALLOC)
|
||||
// mi_option_set(mi_option_purge_delay,-1);
|
||||
mi_option_set(mi_option_reclaim_on_free, 0);
|
||||
#endif
|
||||
#ifndef USE_STD_MALLOC
|
||||
mi_stats_reset();
|
||||
|
@ -350,7 +351,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
|
||||
|
|
Loading…
Add table
Reference in a new issue