Index: third_party/tcmalloc/chromium/src/tests/system-alloc_unittest.cc |
=================================================================== |
--- third_party/tcmalloc/chromium/src/tests/system-alloc_unittest.cc (revision 124832) |
+++ third_party/tcmalloc/chromium/src/tests/system-alloc_unittest.cc (working copy) |
@@ -40,9 +40,8 @@ |
#endif |
#include <sys/types.h> |
#include <algorithm> |
-#include <limits> |
#include "base/logging.h" // for Check_GEImpl, Check_LTImpl, etc |
-#include <gperftools/malloc_extension.h> // for MallocExtension::instance |
+#include <google/malloc_extension.h> // for MallocExtension::instance |
#include "common.h" // for kAddressBits |
class ArraySysAllocator : public SysAllocator { |
@@ -84,6 +83,7 @@ |
void DumpStats() { |
} |
+ void FlagsInitialized() {} |
private: |
static const int kArraySize = 8 * 1024 * 1024; |
@@ -115,30 +115,14 @@ |
const int kPointerBits = 8 * sizeof(void*); |
const int kImplementedVirtualBits = NumImplementedVirtualBits(); |
- CHECK_GE(kAddressBits, std::min(kImplementedVirtualBits, kPointerBits)); |
+ CHECK_GE(kAddressBits, min(kImplementedVirtualBits, kPointerBits)); |
} |
#endif |
static void TestBasicRetryFailTest() { |
// Check with the allocator still works after a failed allocation. |
- // |
- // There is no way to call malloc and guarantee it will fail. malloc takes a |
- // size_t parameter and the C++ standard does not constrain the size of |
- // size_t. For example, consider an implementation where size_t is 32 bits |
- // and pointers are 64 bits. |
- // |
- // It is likely, though, that sizeof(size_t) == sizeof(void*). In that case, |
- // the first allocation here might succeed but the second allocation must |
- // fail. |
- // |
- // If the second allocation succeeds, you will have to rewrite or |
- // disable this test. |
- // The weird parens are to avoid macro-expansion of 'max' on windows. |
- const size_t kHugeSize = (std::numeric_limits<size_t>::max)() / 2; |
- void* p1 = malloc(kHugeSize); |
- void* p2 = malloc(kHugeSize); |
- CHECK(p2 == NULL); |
- if (p1 != NULL) free(p1); |
+ void* p = malloc(1ULL << 50); // Asking for 1P ram |
+ CHECK(p == NULL); |
char* q = new char[1024]; |
CHECK(q != NULL); |