merge from dev; match test-stress

This commit is contained in:
Daan Leijen 2024-12-20 14:00:02 -08:00
commit 278f1ff556
3 changed files with 8 additions and 9 deletions

View file

@ -272,14 +272,14 @@
<SubSystem>Console</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\test\main-override-static.c" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="mimalloc.vcxproj">
<Project>{abb5eae7-b3e6-432e-b636-333449892ea6}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\test\main-override-static.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -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

View file

@ -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;
}