Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Unified Diff: base/allocator/tcmalloc_unittest.cc

Issue 2790173004: tcmalloc_unittest: Don't run Realloc test on low memory devices (Closed)
Patch Set: Address comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/tcmalloc_unittest.cc
diff --git a/base/allocator/tcmalloc_unittest.cc b/base/allocator/tcmalloc_unittest.cc
index 5313bfdf65270f45db2d98783a3cf34286c06ea6..47246585f0681c0226da70a8a44b118dbb4139ad 100644
--- a/base/allocator/tcmalloc_unittest.cc
+++ b/base/allocator/tcmalloc_unittest.cc
@@ -8,6 +8,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/process/process_metrics.h"
+#include "base/sys_info.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -86,6 +87,10 @@ static void TestCalloc(size_t n, size_t s, bool ok) {
}
}
+bool IsLowMemoryDevice() {
+ return base::SysInfo::AmountOfPhysicalMemory() <= 256LL * 1024 * 1024;
+}
+
} // namespace
TEST(TCMallocTest, Malloc) {
@@ -154,6 +159,12 @@ TEST(TCMallocTest, Realloc) {
}
}
+ // The logic below tries to allocate kNumEntries * 9000 ~= 130 MB of memory.
+ // This would cause the test to crash on low memory devices with no VM
+ // overcommit (e.g., chromecast).
+ if (IsLowMemoryDevice())
+ return;
+
// Now make sure realloc works correctly even when we overflow the
// packed cache, so some entries are evicted from the cache.
// The cache has 2^12 entries, keyed by page number.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698