mirror of
https://github.com/microsoft/mimalloc.git
synced 2024-12-25 20:14:12 +08:00
Merge branch 'dev3' into dev3-bin
This commit is contained in:
commit
50d22cf092
@ -396,8 +396,8 @@ typedef enum mi_option_e {
|
||||
mi_option_guarded_sample_seed, // can be set to allow for a (more) deterministic re-execution when a guard page is triggered (=0)
|
||||
mi_option_target_segments_per_thread, // experimental (=0)
|
||||
mi_option_reclaim_on_free, // allow to reclaim an abandoned segment on a free (=1)
|
||||
mi_option_full_page_retain, // retain N full pages per size class (=2)
|
||||
mi_option_max_page_candidates, // max candidate pages to consider for allocation (=4)
|
||||
mi_option_page_full_retain, // retain N full pages per size class (=2)
|
||||
mi_option_page_max_candidates, // max candidate pages to consider for allocation (=4)
|
||||
mi_option_max_vabits, // max user space virtual address bits to consider (=48)
|
||||
mi_option_pagemap_commit, // commit the full pagemap (to always catch invalid pointer uses) (=0)
|
||||
mi_option_page_commit_on_demand, // commit page memory on-demand
|
||||
|
@ -176,8 +176,8 @@ void _mi_heap_init(mi_heap_t* heap, mi_arena_id_t arena_id, bool noreclaim, uint
|
||||
heap->tld = tld; // avoid reading the thread-local tld during initialization
|
||||
heap->exclusive_arena = _mi_arena_from_id(arena_id);
|
||||
heap->allow_page_reclaim = !noreclaim;
|
||||
heap->allow_page_abandon = (!noreclaim && mi_option_get(mi_option_full_page_retain) >= 0);
|
||||
heap->full_page_retain = mi_option_get_clamp(mi_option_full_page_retain, -1, 32);
|
||||
heap->allow_page_abandon = (!noreclaim && mi_option_get(mi_option_page_full_retain) >= 0);
|
||||
heap->full_page_retain = mi_option_get_clamp(mi_option_page_full_retain, -1, 32);
|
||||
heap->tag = heap_tag;
|
||||
if (heap->tld->is_in_threadpool) {
|
||||
// if we run as part of a thread pool it is better to not arbitrarily reclaim abandoned pages into our heap.
|
||||
|
@ -255,8 +255,8 @@ static void mi_heap_main_init(void) {
|
||||
//heap_main.keys[0] = _mi_heap_random_next(&heap_main);
|
||||
//heap_main.keys[1] = _mi_heap_random_next(&heap_main);
|
||||
_mi_heap_guarded_init(&heap_main);
|
||||
heap_main.allow_page_abandon = (mi_option_get(mi_option_full_page_retain) >= 0);
|
||||
heap_main.full_page_retain = mi_option_get_clamp(mi_option_full_page_retain, -1, 32);
|
||||
heap_main.allow_page_abandon = (mi_option_get(mi_option_page_full_retain) >= 0);
|
||||
heap_main.full_page_retain = mi_option_get_clamp(mi_option_page_full_retain, -1, 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,8 +170,8 @@ static mi_option_desc_t options[_mi_option_last] =
|
||||
{ 0, UNINIT, MI_OPTION(guarded_sample_seed)},
|
||||
{ 0, UNINIT, MI_OPTION(target_segments_per_thread) }, // abandon segments beyond this point, or 0 to disable.
|
||||
{ 1, UNINIT, MI_OPTION_LEGACY(reclaim_on_free, abandoned_reclaim_on_free) },// reclaim an abandoned segment on a free
|
||||
{ 2, UNINIT, MI_OPTION(full_page_retain) },
|
||||
{ 4, UNINIT, MI_OPTION(max_page_candidates) },
|
||||
{ 2, UNINIT, MI_OPTION(page_full_retain) },
|
||||
{ 4, UNINIT, MI_OPTION(page_max_candidates) },
|
||||
{ 0, UNINIT, MI_OPTION(max_vabits) },
|
||||
{ MI_DEFAULT_PAGEMAP_COMMIT,
|
||||
UNINIT, MI_OPTION(pagemap_commit) }, // commit the full pagemap upfront?
|
||||
|
@ -721,7 +721,7 @@ static mi_decl_noinline mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, m
|
||||
// we prefer non-expandable pages with high usage as candidates (to reduce commit, and increase chances of free-ing up pages)
|
||||
if (page_candidate == NULL) {
|
||||
page_candidate = page;
|
||||
candidate_limit = _mi_option_get_fast(mi_option_max_page_candidates);
|
||||
candidate_limit = _mi_option_get_fast(mi_option_page_max_candidates);
|
||||
}
|
||||
else if (mi_page_all_free(page_candidate)) {
|
||||
_mi_page_free(page_candidate, pq);
|
||||
|
Loading…
x
Reference in New Issue
Block a user