only collect retired at fresh page allocation
@@ -408,7 +408,7 @@ void _mi_page_retire(mi_page_t* page) {
if (mi_likely(page->xblock_size <= MI_SMALL_SIZE_MAX && !mi_page_is_in_full(page))) {
if (pq->last==page && pq->first==page) { // the only page in the queue?
mi_stat_counter_increase(_mi_stats_main.page_no_retire,1);
- page->retire_expire = 4;
+ page->retire_expire = 16;
mi_assert_internal(mi_page_all_free(page));
return; // dont't free after all
}
@@ -678,6 +678,7 @@ static mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, mi_page_queue_t* p
mi_stat_counter_increase(heap->tld->stats.searches, count);
if (page == NULL) {
+ _mi_heap_collect_retired(heap, false); // perhaps make a page available
page = mi_page_fresh(heap, pq);
}
else {
@@ -686,8 +687,6 @@ static mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, mi_page_queue_t* p
}
mi_assert_internal(page == NULL || mi_page_immediate_available(page));
- // finally collect retired pages
- _mi_heap_collect_retired(heap, false);
return page;
}
