Use madvise MADV_DONTNEED.
There appears to be a race condition where the allocated memory
is not released properly. Instead of madvise MADV_PAGEOUT, use
MADV_DONTNEED to see if this fixes the problem.
Bug: 390062915
Test: All unit tests cases pass.
Test: Ran all unit test cases thousands of times with no failures.
Change-Id: I7bcd6634412cd5a2d23f75f4ce3bcdf5e4e6b531
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
index b24f4ad..79f946f 100644
--- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
+++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp
@@ -2581,7 +2581,7 @@
// Mark only some pages in use.
uint8_t* data = reinterpret_cast<uint8_t*>(ptr);
// Make sure the memory is not in use.
- ASSERT_EQ(0, madvise(ptr, pagesize * 8, MADV_PAGEOUT));
+ ASSERT_EQ(0, madvise(ptr, pagesize * 8, MADV_DONTNEED));
// Dirty three non-consecutive pages.
data[0] = 1;
data[pagesize * 2] = 1;