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/src/page.c b/src/page.c index 0de56752..d97537d1 100644 --- a/src/page.c +++ b/src/page.c @@ -682,7 +682,8 @@ static mi_decl_noinline mi_page_t* mi_page_queue_find_free_ex(mi_heap_t* heap, m _mi_page_free(page_candidate, pq); page_candidate = page; } - else if (page->used >= page_candidate->used && !mi_page_is_mostly_used(page)) { + // 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 1f8df226..b35743df 100644 --- a/test/test-stress.c +++ b/test/test-stress.c @@ -44,12 +44,10 @@ static int ITER = 10; static int THREADS = 4; static int SCALE = 10; static int ITER = 20; -#define ALLOW_LARGE false #elif 0 static int THREADS = 32; static int SCALE = 50; static int ITER = 50; -#define ALLOW_LARGE false #elif 0 static int THREADS = 64; static int SCALE = 400; @@ -57,7 +55,7 @@ static int ITER = 10; #define ALLOW_LARGE true #else static int THREADS = 32; // more repeatable if THREADS <= #processors -static int SCALE = 25; // scaling factor +static int SCALE = 50; // scaling factor static int ITER = 50; // N full iterations destructing and re-creating all threads #endif @@ -66,7 +64,7 @@ static int ITER = 50; // N full iterations destructing and re-creating a #define STRESS // undefine for leak test #ifndef ALLOW_LARGE -#define ALLOW_LARGE true +#define ALLOW_LARGE false #endif static bool allow_large_objects = ALLOW_LARGE; // allow very large objects? (set to `true` if SCALE>100) @@ -360,7 +358,7 @@ int main(int argc, char** argv) { #else mi_stats_print(NULL); // so we see rss/commit/elapsed #endif - //mi_stats_print(NULL); + mi_stats_print(NULL); //bench_end_program(); return 0; }