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

Unified Diff: base/allocator/tcmalloc_unittest.cc

Issue 2790173004: tcmalloc_unittest: Don't run Realloc test on low memory devices (Closed)
Patch Set: 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..4066079f5e0b108f5d20b2460d4d422cdb12d0a9 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,11 @@ static void TestCalloc(size_t n, size_t s, bool ok) {
}
}
+bool IsLowMemoryDevice() {
+ // 256MiB
Primiano Tucci (use gerrit) 2017/04/04 14:10:51 this is IMHO redundant given the code below, and j
bcf 2017/04/04 18:44:06 Done.
+ return base::SysInfo::AmountOfPhysicalMemory() <= 256LL * 1024 * 1024;
+}
+
} // namespace
TEST(TCMallocTest, Malloc) {
@@ -140,6 +146,9 @@ TEST(TCMallocTest, ReallocSmallDelta) {
#endif
TEST(TCMallocTest, Realloc) {
+ if (IsLowMemoryDevice())
Primiano Tucci (use gerrit) 2017/04/04 14:10:51 to be honest, you could have moved the early retur
bcf 2017/04/04 18:44:06 Done.
+ return;
+
for (int src_size = 0; src_size >= 0; src_size = NextSize(src_size)) {
for (int dst_size = 0; dst_size >= 0; dst_size = NextSize(dst_size)) {
unsigned char* src = reinterpret_cast<unsigned char*>(malloc(src_size));
« 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