mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-06 19:38:41 +03:00
insert full pages at the end of the queue; only override page candidate if the page is not too full
This commit is contained in:
parent
df82338d8a
commit
f3d83e5fa6
5 changed files with 8 additions and 7 deletions
|
@ -343,7 +343,7 @@ static void mi_page_queue_enqueue_from(mi_page_queue_t* to, mi_page_queue_t* fro
|
|||
|
||||
static void mi_page_queue_enqueue_from_full(mi_page_queue_t* to, mi_page_queue_t* from, mi_page_t* page) {
|
||||
// note: we could insert at the front to increase reuse, but it slows down certain benchmarks (like `alloc-test`)
|
||||
mi_page_queue_enqueue_from_ex(to, from, false /* enqueue at the end of the `to` queue? */, page);
|
||||
mi_page_queue_enqueue_from_ex(to, from, true /* enqueue at the end of the `to` queue? */, page);
|
||||
}
|
||||
|
||||
// Only called from `mi_heap_absorb`.
|
||||
|
|
|
@ -783,7 +783,8 @@ static mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, mi_page_queue_t* p
|
|||
page_candidate = page;
|
||||
candidate_count = 0;
|
||||
}
|
||||
else if (!mi_page_mostly_used(page) && page->used >= page_candidate->used) {
|
||||
// prefer to reuse fuller pages (in the hope the less used page gets freed)
|
||||
else if (page->used >= page_candidate->used && !mi_page_is_mostly_used(page) && !mi_page_is_expandable(page)) {
|
||||
page_candidate = page;
|
||||
}
|
||||
// if we find a non-expandable candidate, or searched for N pages, return with the best candidate
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue