Index: compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc =================================================================== --- compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc +++ compiler-rt/trunk/lib/asan/tests/asan_noinst_test.cc @@ -170,6 +170,12 @@ // Check that the thread local allocators are flushed when threads are // destroyed. TEST(AddressSanitizer, ThreadedQuarantineTest) { + // Run the routine once to warm up ASAN internal structures to get more + // predictable incremental memory changes. + pthread_t t; + PTHREAD_CREATE(&t, NULL, ThreadedQuarantineTestWorker, 0); + PTHREAD_JOIN(t, 0); + const int n_threads = 3000; size_t mmaped1 = __sanitizer_get_heap_size(); for (int i = 0; i < n_threads; i++) { @@ -178,7 +184,7 @@ PTHREAD_JOIN(t, 0); size_t mmaped2 = __sanitizer_get_heap_size(); // Figure out why this much memory is required. - EXPECT_LT(mmaped2 - mmaped1, 352U * (1 << 20)); + EXPECT_LT(mmaped2 - mmaped1, 320U * (1 << 20)); } }