| Index: third_party/tcmalloc/vendor/src/common.cc
|
| diff --git a/third_party/tcmalloc/vendor/src/common.cc b/third_party/tcmalloc/vendor/src/common.cc
|
| index 90e6626a9e3756dc391818a27eb06d6cedad7de4..dad7372ffefe789561e18ae3a24100e5a58634d2 100644
|
| --- a/third_party/tcmalloc/vendor/src/common.cc
|
| +++ b/third_party/tcmalloc/vendor/src/common.cc
|
| @@ -99,10 +99,12 @@ int SizeMap::NumMoveSize(size_t size) {
|
| void SizeMap::Init() {
|
| // Do some sanity checking on add_amount[]/shift_amount[]/class_array[]
|
| if (ClassIndex(0) < 0) {
|
| - CRASH("Invalid class index %d for size 0\n", ClassIndex(0));
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "Invalid class index for size 0", ClassIndex(0));
|
| }
|
| if (ClassIndex(kMaxSize) >= sizeof(class_array_)) {
|
| - CRASH("Invalid class index %d for kMaxSize\n", ClassIndex(kMaxSize));
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "Invalid class index for kMaxSize", ClassIndex(kMaxSize));
|
| }
|
|
|
| // Compute the size classes we want to use
|
| @@ -147,8 +149,8 @@ void SizeMap::Init() {
|
| sc++;
|
| }
|
| if (sc != kNumClasses) {
|
| - CRASH("wrong number of size classes: found %d instead of %d\n",
|
| - sc, int(kNumClasses));
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "wrong number of size classes: (found vs. expected )", sc, kNumClasses);
|
| }
|
|
|
| // Initialize the mapping arrays
|
| @@ -165,18 +167,17 @@ void SizeMap::Init() {
|
| for (size_t size = 0; size <= kMaxSize; size++) {
|
| const int sc = SizeClass(size);
|
| if (sc <= 0 || sc >= kNumClasses) {
|
| - CRASH("Bad size class %d for %" PRIuS "\n", sc, size);
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "Bad size class (class, size)", sc, size);
|
| }
|
| if (sc > 1 && size <= class_to_size_[sc-1]) {
|
| - CRASH("Allocating unnecessarily large class %d for %" PRIuS
|
| - "\n", sc, size);
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "Allocating unnecessarily large class (class, size)", sc, size);
|
| }
|
| const size_t s = class_to_size_[sc];
|
| - if (size > s) {
|
| - CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc);
|
| - }
|
| - if (s == 0) {
|
| - CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc);
|
| + if (size > s || s == 0) {
|
| + Log(kCrash, __FILE__, __LINE__,
|
| + "Bad (class, size, requested)", sc, s, size);
|
| }
|
| }
|
|
|
| @@ -186,23 +187,6 @@ void SizeMap::Init() {
|
| }
|
| }
|
|
|
| -void SizeMap::Dump(TCMalloc_Printer* out) {
|
| - // Dump class sizes and maximum external wastage per size class
|
| - for (size_t cl = 1; cl < kNumClasses; ++cl) {
|
| - const int alloc_size = class_to_pages_[cl] << kPageShift;
|
| - const int alloc_objs = alloc_size / class_to_size_[cl];
|
| - const int min_used = (class_to_size_[cl-1] + 1) * alloc_objs;
|
| - const int max_waste = alloc_size - min_used;
|
| - out->printf("SC %3d [ %8d .. %8d ] from %8d ; %2.0f%% maxwaste\n",
|
| - int(cl),
|
| - int(class_to_size_[cl-1] + 1),
|
| - int(class_to_size_[cl]),
|
| - int(class_to_pages_[cl] << kPageShift),
|
| - max_waste * 100.0 / alloc_size
|
| - );
|
| - }
|
| -}
|
| -
|
| // Metadata allocator -- keeps stats about how many bytes allocated.
|
| static uint64_t metadata_system_bytes_ = 0;
|
| void* MetaDataAlloc(size_t bytes) {
|
|
|