Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/tcmalloc/vendor/src/thread_cache.h

Issue 9316021: Update the tcmalloc vendor branch to r144 (gperftools 2.0). (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reuploading Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/tcmalloc/vendor/src/thread_cache.h
diff --git a/third_party/tcmalloc/vendor/src/thread_cache.h b/third_party/tcmalloc/vendor/src/thread_cache.h
index 1742d5ba54e57fad4fea8e1612f7ce4a83be29f9..1d0413b2a8a1dc712defa76ae103eea9ff011209 100644
--- a/third_party/tcmalloc/vendor/src/thread_cache.h
+++ b/third_party/tcmalloc/vendor/src/thread_cache.h
@@ -94,7 +94,6 @@ class ThreadCache {
void Deallocate(void* ptr, size_t size_class);
void Scavenge();
- void Print(TCMalloc_Printer* out) const;
int GetSamplePeriod();
@@ -120,10 +119,6 @@ class ThreadCache {
// REQUIRES: Static::pageheap_lock is held.
static void GetThreadStats(uint64_t* total_bytes, uint64_t* class_count);
- // Write debugging statistics to 'out'.
- // REQUIRES: Static::pageheap_lock is held.
- static void PrintThreads(TCMalloc_Printer* out);
-
// Sets the total thread cache size to new_size, recomputing the
// individual thread cache sizes as necessary.
// REQUIRES: Static::pageheap lock is held.
@@ -209,6 +204,10 @@ class ThreadCache {
return SLL_Pop(&list_);
}
+ void* Next() {
+ return SLL_Next(&list_);
+ }
+
void PushRange(int N, void *start, void *end) {
SLL_PushRange(&list_, start, end);
length_ += N;
@@ -349,6 +348,12 @@ inline void ThreadCache::Deallocate(void* ptr, size_t cl) {
FreeList* list = &list_[cl];
size_ += Static::sizemap()->ByteSizeForClass(cl);
ssize_t size_headroom = max_size_ - size_ - 1;
+
+ // This catches back-to-back frees of allocs in the same size
+ // class. A more comprehensive (and expensive) test would be to walk
+ // the entire freelist. But this might be enough to find some bugs.
+ ASSERT(ptr != list->Next());
+
list->Push(ptr);
ssize_t list_headroom =
static_cast<ssize_t>(list->max_length()) - list->length();
« no previous file with comments | « third_party/tcmalloc/vendor/src/tests/thread_dealloc_unittest.cc ('k') | third_party/tcmalloc/vendor/src/thread_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698