mirror of
https://github.com/microsoft/mimalloc.git
synced 2025-07-05 19:14:37 +03:00
merge from dev
This commit is contained in:
commit
3903f09b28
4 changed files with 4 additions and 4 deletions
|
@ -609,7 +609,7 @@ static inline bool mi_page_immediate_available(const mi_page_t* page) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// is more than 7/8th of a page in use?
|
// is more than 7/8th of a page in use?
|
||||||
static inline bool mi_page_mostly_used(const mi_page_t* page) {
|
static inline bool mi_page_is_mostly_used(const mi_page_t* page) {
|
||||||
if (page==NULL) return true;
|
if (page==NULL) return true;
|
||||||
uint16_t frac = page->reserved / 8U;
|
uint16_t frac = page->reserved / 8U;
|
||||||
return (page->reserved - page->used <= frac);
|
return (page->reserved - page->used <= frac);
|
||||||
|
|
|
@ -348,7 +348,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) {
|
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`)
|
// 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`.
|
// Only called from `mi_heap_absorb`.
|
||||||
|
|
|
@ -788,7 +788,8 @@ static mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, mi_page_queue_t* p
|
||||||
page_candidate = page;
|
page_candidate = page;
|
||||||
candidate_count = 0;
|
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;
|
page_candidate = page;
|
||||||
}
|
}
|
||||||
// if we find a non-expandable candidate, or searched for N pages, return with the best candidate
|
// if we find a non-expandable candidate, or searched for N pages, return with the best candidate
|
||||||
|
|
|
@ -326,7 +326,6 @@ int main(int argc, char** argv) {
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
mi_stats_print(NULL);
|
mi_stats_print(NULL);
|
||||||
//mi_stats_print(NULL);
|
|
||||||
//bench_end_program();
|
//bench_end_program();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue