File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -454,21 +454,27 @@ CATCH_TEST_CASE("RangeSearchFunctional", "[runtime]") {
454454}
455455
456456CATCH_TEST_CASE (" MemoryUsageOnLoad" , " [runtime][memory]" ) {
457+ auto threshold = [](size_t size_on_disk) {
458+ // On load, the allocator allocates blocks of 64 MB
459+ constexpr std::uint64_t ALIGN = 64ull * 1024 * 1024 ; // 64 MB
460+ return size_t ((size_on_disk + ALIGN - 1 ) / ALIGN * ALIGN);
461+ };
462+
457463 CATCH_SECTION (" SmallIndex" ) {
458464 auto stats = run_save_and_load_test (10 );
459465 CATCH_REQUIRE (stats.file_size < 20 * 1024 * 1024 );
460- CATCH_REQUIRE (stats.rss_increase < 1.2 * stats.file_size );
466+ CATCH_REQUIRE (stats.rss_increase < threshold ( stats.file_size ) );
461467 }
462468
463469 CATCH_SECTION (" MediumIndex" ) {
464470 auto stats = run_save_and_load_test (50 );
465471 CATCH_REQUIRE (stats.file_size < 100 * 1024 * 1024 );
466- CATCH_REQUIRE (stats.rss_increase < 1.2 * stats.file_size );
472+ CATCH_REQUIRE (stats.rss_increase < threshold ( stats.file_size ) );
467473 }
468474
469475 CATCH_SECTION (" LargeIndex" ) {
470476 auto stats = run_save_and_load_test (200 );
471477 CATCH_REQUIRE (stats.file_size < 400 * 1024 * 1024 );
472- CATCH_REQUIRE (stats.rss_increase < 1.2 * stats.file_size );
478+ CATCH_REQUIRE (stats.rss_increase < threshold ( stats.file_size ) );
473479 }
474480}
You can’t perform that action at this time.
0 commit comments