mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-05-05 23:19:31 +03:00
fix eager_delay test, and allow large OS pages even without eager commit enabled
This commit is contained in:
parent
64c1d6de86
commit
4b39c0b06e
1 changed files with 3 additions and 2 deletions
|
@ -326,7 +326,8 @@ static mi_segment_t* mi_segment_alloc(size_t required, mi_page_kind_t page_kind,
|
||||||
size_t page_size = (page_kind == MI_PAGE_HUGE ? segment_size : (size_t)1 << page_shift);
|
size_t page_size = (page_kind == MI_PAGE_HUGE ? segment_size : (size_t)1 << page_shift);
|
||||||
|
|
||||||
// Try to get it from our thread local cache first
|
// Try to get it from our thread local cache first
|
||||||
bool eager = mi_option_is_enabled(mi_option_eager_commit) && (tld->count < (size_t)mi_option_get(mi_option_eager_commit_delay));
|
bool eager_delay = (tld->count < (size_t)mi_option_get(mi_option_eager_commit_delay));
|
||||||
|
bool eager = !eager_delay && mi_option_is_enabled(mi_option_eager_commit);
|
||||||
bool commit = eager || (page_kind > MI_PAGE_MEDIUM);
|
bool commit = eager || (page_kind > MI_PAGE_MEDIUM);
|
||||||
bool protection_still_good = false;
|
bool protection_still_good = false;
|
||||||
mi_segment_t* segment = mi_segment_cache_pop(segment_size, tld);
|
mi_segment_t* segment = mi_segment_cache_pop(segment_size, tld);
|
||||||
|
@ -353,7 +354,7 @@ static mi_segment_t* mi_segment_alloc(size_t required, mi_page_kind_t page_kind,
|
||||||
else {
|
else {
|
||||||
// Allocate the segment from the OS
|
// Allocate the segment from the OS
|
||||||
size_t memid;
|
size_t memid;
|
||||||
bool mem_large = (eager && !mi_option_is_enabled(mi_option_secure)); // only allow large OS pages once we are no longer lazy
|
bool mem_large = (!eager_delay && !mi_option_is_enabled(mi_option_secure)); // only allow large OS pages once we are no longer lazy
|
||||||
segment = (mi_segment_t*)_mi_mem_alloc_aligned(segment_size, MI_SEGMENT_SIZE, &commit, &mem_large, &memid, os_tld);
|
segment = (mi_segment_t*)_mi_mem_alloc_aligned(segment_size, MI_SEGMENT_SIZE, &commit, &mem_large, &memid, os_tld);
|
||||||
if (segment == NULL) return NULL; // failed to allocate
|
if (segment == NULL) return NULL; // failed to allocate
|
||||||
if (!commit) {
|
if (!commit) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue