Chromium Code Reviews| 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)); |