OLD | NEW |
1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2008, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 (tcmalloc::kSupportsDoublyLinkedList ? 2 : 1); | 72 (tcmalloc::kSupportsDoublyLinkedList ? 2 : 1); |
73 static const size_t kLinkSize = kNumFreeListPointers * sizeof(void *); | 73 static const size_t kLinkSize = kNumFreeListPointers * sizeof(void *); |
74 static const size_t kMinClassSize = | 74 static const size_t kMinClassSize = |
75 (kLinkSize > kAlignment ? kLinkSize : kAlignment); | 75 (kLinkSize > kAlignment ? kLinkSize : kAlignment); |
76 static const size_t kSkippedClasses = (kAlignment < kMinClassSize ? 1 : 0); | 76 static const size_t kSkippedClasses = (kAlignment < kMinClassSize ? 1 : 0); |
77 | 77 |
78 #if defined(TCMALLOC_LARGE_PAGES) | 78 #if defined(TCMALLOC_LARGE_PAGES) |
79 static const size_t kPageShift = 15; | 79 static const size_t kPageShift = 15; |
80 static const size_t kNumClasses = 78 - kSkippedClasses; | 80 static const size_t kNumClasses = 78 - kSkippedClasses; |
81 #else | 81 #else |
82 static const size_t kPageShift = 13; | 82 // Original TCMalloc code used kPageShift == 13. In Chromium, we changed |
83 static const size_t kNumClasses = 86 - kSkippedClasses; | 83 // this to 12 (as was done in prior versions of TCMalloc). |
| 84 static const size_t kPageShift = 12; |
| 85 static const size_t kNumClasses = 54 - kSkippedClasses; |
84 #endif | 86 #endif |
85 static const size_t kMaxThreadCacheSize = 4 << 20; | 87 static const size_t kMaxThreadCacheSize = 4 << 20; |
86 | 88 |
87 static const size_t kPageSize = 1 << kPageShift; | 89 static const size_t kPageSize = 1 << kPageShift; |
88 // TODO(dmikurube): We Chromium may want to tune this kMaxSize. | 90 // Original TCMalloc code used kMaxSize == 256 * 1024. In Chromium, we |
89 static const size_t kMaxSize = 256 * 1024; | 91 // changed this to 32K, and represent it in terms of page size (as was done |
| 92 // in prior versions of TCMalloc). |
| 93 static const size_t kMaxSize = 8u * kPageSize; |
90 // For all span-lengths < kMaxPages we keep an exact-size list. | 94 // For all span-lengths < kMaxPages we keep an exact-size list. |
91 static const size_t kMaxPages = 1 << (20 - kPageShift); | 95 static const size_t kMaxPages = 1 << (20 - kPageShift); |
92 | 96 |
93 // Default bound on the total amount of thread caches. | 97 // Default bound on the total amount of thread caches. |
94 #ifdef TCMALLOC_SMALL_BUT_SLOW | 98 #ifdef TCMALLOC_SMALL_BUT_SLOW |
95 // Make the overall thread cache no bigger than that of a single thread | 99 // Make the overall thread cache no bigger than that of a single thread |
96 // for the small memory footprint case. | 100 // for the small memory footprint case. |
97 static const size_t kDefaultOverallThreadCacheSize = kMaxThreadCacheSize; | 101 static const size_t kDefaultOverallThreadCacheSize = kMaxThreadCacheSize; |
98 #else | 102 #else |
99 static const size_t kDefaultOverallThreadCacheSize = 8u * kMaxThreadCacheSize; | 103 static const size_t kDefaultOverallThreadCacheSize = 8u * kMaxThreadCacheSize; |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 static const int kMaxStackDepth = 31; | 258 static const int kMaxStackDepth = 31; |
255 struct StackTrace { | 259 struct StackTrace { |
256 uintptr_t size; // Size of object | 260 uintptr_t size; // Size of object |
257 uintptr_t depth; // Number of PC values stored in array below | 261 uintptr_t depth; // Number of PC values stored in array below |
258 void* stack[kMaxStackDepth]; | 262 void* stack[kMaxStackDepth]; |
259 }; | 263 }; |
260 | 264 |
261 } // namespace tcmalloc | 265 } // namespace tcmalloc |
262 | 266 |
263 #endif // TCMALLOC_COMMON_H_ | 267 #endif // TCMALLOC_COMMON_H_ |
OLD | NEW |