Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2008, Google Inc. | 1 // Copyright (c) 2011, 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 |
| 11 // copyright notice, this list of conditions and the following disclaimer | 11 // copyright notice, this list of conditions and the following disclaimer |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 } | 155 } |
| 156 next_size = max_size_in_class + kAlignment; | 156 next_size = max_size_in_class + kAlignment; |
| 157 } | 157 } |
| 158 | 158 |
| 159 // Double-check sizes just to be safe | 159 // Double-check sizes just to be safe |
| 160 for (size_t size = 0; size <= kMaxSize; size++) { | 160 for (size_t size = 0; size <= kMaxSize; size++) { |
| 161 const int sc = SizeClass(size); | 161 const int sc = SizeClass(size); |
| 162 if (sc <= 0 || sc >= kNumClasses) { | 162 if (sc <= 0 || sc >= kNumClasses) { |
| 163 CRASH("Bad size class %d for %" PRIuS "\n", sc, size); | 163 CRASH("Bad size class %d for %" PRIuS "\n", sc, size); |
| 164 } | 164 } |
| 165 if (sc > 1 && size <= class_to_size_[sc-1]) { | 165 if (sc > FIRST_SIZE_CLASS && size <= class_to_size_[sc-1]) { |
|
jar (doing other things)
2011/08/20 02:40:30
The name seems bad, since it is actually the first
bxx
2011/08/24 00:19:24
Done.
| |
| 166 CRASH("Allocating unnecessarily large class %d for %" PRIuS | 166 CRASH("Allocating unnecessarily large class %d for %" PRIuS |
| 167 "\n", sc, size); | 167 "\n", sc, size); |
| 168 } | 168 } |
| 169 const size_t s = class_to_size_[sc]; | 169 const size_t s = class_to_size_[sc]; |
| 170 if (size > s) { | 170 if (size > s) { |
| 171 CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc); | 171 CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc); |
| 172 } | 172 } |
| 173 if (s == 0) { | 173 if (s == 0) { |
| 174 CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc); | 174 CRASH("Bad size %" PRIuS " for %" PRIuS " (sc = %d)\n", s, size, sc); |
| 175 } | 175 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 return result; | 208 return result; |
| 209 } | 209 } |
| 210 | 210 |
| 211 uint64_t metadata_system_bytes() { return metadata_system_bytes_; } | 211 uint64_t metadata_system_bytes() { return metadata_system_bytes_; } |
| 212 | 212 |
| 213 void increment_metadata_system_bytes(size_t bytes) { | 213 void increment_metadata_system_bytes(size_t bytes) { |
| 214 metadata_system_bytes_ += bytes; | 214 metadata_system_bytes_ += bytes; |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace tcmalloc | 217 } // namespace tcmalloc |
| OLD | NEW |