[compiler-rt] [scudo] Remove ResidentMemorySize test. (PR #145955)
Christopher Ferris via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 26 12:26:04 PDT 2025
https://github.com/cferris1000 created https://github.com/llvm/llvm-project/pull/145955
This test is not very accurate, and nearly everything in Scudo would fail if this didn't work. It's now failing in Android, which is the reason for deleting.
Filed bug to replace with a more accurate version of this test.
>From 44c111858fa8cf074aa02f971bbb1ca0055d2a37 Mon Sep 17 00:00:00 2001
From: Christopher Ferris <cferris at google.com>
Date: Thu, 26 Jun 2025 12:17:19 -0700
Subject: [PATCH] [scudo] Remove ResidentMemorySize test.
This test is not very accurate, and nearly everything in Scudo would
fail if this didn't work. It's now failing in Android, which is the
reason for deleting.
Filed bug to replace with a more accurate version of this test.
---
.../scudo/standalone/tests/common_test.cpp | 37 -------------------
1 file changed, 37 deletions(-)
diff --git a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
index e6ddbb00b843c..b63706694c3ac 100644
--- a/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
+++ b/compiler-rt/lib/scudo/standalone/tests/common_test.cpp
@@ -16,43 +16,6 @@
namespace scudo {
-static uptr getResidentMemorySize() {
- if (!SCUDO_LINUX)
- UNREACHABLE("Not implemented!");
- uptr Size;
- uptr Resident;
- std::ifstream IFS("/proc/self/statm");
- IFS >> Size;
- IFS >> Resident;
- return Resident * getPageSizeCached();
-}
-
-// Fuchsia needs getResidentMemorySize implementation.
-TEST(ScudoCommonTest, SKIP_ON_FUCHSIA(ResidentMemorySize)) {
- uptr OnStart = getResidentMemorySize();
- EXPECT_GT(OnStart, 0UL);
-
- const uptr Size = 1ull << 30;
- const uptr Threshold = Size >> 3;
-
- MemMapT MemMap;
- ASSERT_TRUE(MemMap.map(/*Addr=*/0U, Size, "ResidentMemorySize"));
- ASSERT_NE(MemMap.getBase(), 0U);
- void *P = reinterpret_cast<void *>(MemMap.getBase());
- EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);
-
- memset(P, 1, Size);
- EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);
-
- MemMap.releasePagesToOS(MemMap.getBase(), Size);
- EXPECT_LT(getResidentMemorySize(), OnStart + Threshold);
-
- memset(P, 1, Size);
- EXPECT_GT(getResidentMemorySize(), OnStart + Size - Threshold);
-
- MemMap.unmap();
-}
-
TEST(ScudoCommonTest, Zeros) {
const uptr Size = 1ull << 20;
More information about the llvm-commits
mailing list