From f01510ccf2a085088808e673e03f4f2cdb0b5088 Mon Sep 17 00:00:00 2001 From: Aliaksei Kandratsenka Date: Fri, 27 Sep 2024 00:02:50 -0400 Subject: [PATCH] make large_heap_fragmentation_unittest not as painful on windows --- src/tests/large_heap_fragmentation_unittest.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tests/large_heap_fragmentation_unittest.cc b/src/tests/large_heap_fragmentation_unittest.cc index 3aeed72..a6344b3 100644 --- a/src/tests/large_heap_fragmentation_unittest.cc +++ b/src/tests/large_heap_fragmentation_unittest.cc @@ -45,7 +45,17 @@ TEST(LargeHeapFragmentationTest, Basic) { // a big chunk of consecutive memory. Otherwise details of // sys-allocator behavior may trigger fragmentation regardless of // our mitigations. - tc_free(tc_malloc(550 << 20)); +#ifndef _WIN32 + static constexpr size_t kInitialAmt = 550 << 20; +#else + // FIXME: on windows it is quite painful due to syscalls that we do + // when returning memory to kernel whenever returned span touches + // more than one memory "reservation" area. So for now, lets reduce + // pain. And in the future lets make windows case fast. + static constexpr size_t kInitialAmt = 1000 << 20; +#endif + + tc_free(tc_malloc(kInitialAmt)); MallocExtension::instance()->ReleaseFreeMemory(); for (int pass = 1; pass <= 3; pass++) {