diff --git a/ide/vs2022/mimalloc-test.vcxproj b/ide/vs2022/mimalloc-test.vcxproj
index a8b36d5e..6e4576fd 100644
--- a/ide/vs2022/mimalloc-test.vcxproj
+++ b/ide/vs2022/mimalloc-test.vcxproj
@@ -272,14 +272,14 @@
Console
+
+
+
{abb5eae7-b3e6-432e-b636-333449892ea6}
-
-
-
diff --git a/include/mimalloc/internal.h b/include/mimalloc/internal.h
index 012ce4f0..8b22e1c6 100644
--- a/include/mimalloc/internal.h
+++ b/include/mimalloc/internal.h
@@ -571,7 +571,7 @@ static inline bool mi_page_immediate_available(const mi_page_t* page) {
}
// 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;
uint16_t frac = page->reserved / 8U;
return (page->reserved - page->used <= frac);
diff --git a/src/page-queue.c b/src/page-queue.c
index 9796f3dc..67b54650 100644
--- a/src/page-queue.c
+++ b/src/page-queue.c
@@ -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`.
diff --git a/src/page.c b/src/page.c
index 4b25ed5d..8808c358 100644
--- a/src/page.c
+++ b/src/page.c
@@ -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
diff --git a/test/test-stress.c b/test/test-stress.c
index 574d241b..6284ad39 100644
--- a/test/test-stress.c
+++ b/test/test-stress.c
@@ -319,7 +319,7 @@ int main(int argc, char** argv) {
mi_collect(true);
#endif
#endif
- //mi_stats_print(NULL);
+ mi_stats_print(NULL);
//bench_end_program();
return 0;
}