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

Unified Diff: third_party/tcmalloc/chromium/src/common.h

Issue 9323026: [NOT TO COMMIT!] r109: Diff of the current tcmalloc from the original google-perftools r109. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 years, 11 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
« no previous file with comments | « third_party/tcmalloc/chromium/src/central_freelist.cc ('k') | third_party/tcmalloc/chromium/src/common.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/common.h
diff --git a/third_party/tcmalloc/chromium/src/common.h b/third_party/tcmalloc/chromium/src/common.h
index e960c574bff5074817a4775e1c06c901227bd88a..78cdc036ceb27bf3538d6c3411810f9a27757ce9 100644
--- a/third_party/tcmalloc/chromium/src/common.h
+++ b/third_party/tcmalloc/chromium/src/common.h
@@ -31,7 +31,6 @@
// Author: Sanjay Ghemawat <opensource@google.com>
//
// Common definitions for tcmalloc code.
-
#ifndef TCMALLOC_COMMON_H_
#define TCMALLOC_COMMON_H_
@@ -40,6 +39,7 @@
#ifdef HAVE_STDINT_H
#include <stdint.h> // for uintptr_t, uint64_t
#endif
+#include "free_list.h" // for SIZE_CLASS macros
#include "internal_logging.h" // for ASSERT, etc
// Type that can hold a page number
@@ -61,20 +61,30 @@ typedef uintptr_t Length;
// central lists. Also, larger pages are less likely to get freed.
// These two factors cause a bounded increase in memory use.
+static const size_t kAlignment = 8;
+
+// Constants dependant on tcmalloc configuration and archetecture.
+// We need to guarantee the smallest class size is big enough to hold the
+// pointers that form the free list.
+static const size_t kNumFreeListPointers =
+ (tcmalloc::kSupportsDoublyLinkedList ? 2 : 1);
+static const size_t kLinkSize = kNumFreeListPointers * sizeof(void *);
+static const size_t kMinClassSize =
+ (kLinkSize > kAlignment ? kLinkSize : kAlignment);
+static const size_t kSkippedClasses = (kAlignment < kMinClassSize ? 1 : 0);
+
#if defined(TCMALLOC_LARGE_PAGES)
static const size_t kPageShift = 15;
-static const size_t kNumClasses = 95;
+static const size_t kNumClasses = 95 - kSkippedClasses;
static const size_t kMaxThreadCacheSize = 4 << 20;
#else
static const size_t kPageShift = 12;
-static const size_t kNumClasses = 61;
+static const size_t kNumClasses = 61 - kSkippedClasses;
static const size_t kMaxThreadCacheSize = 2 << 20;
#endif
static const size_t kPageSize = 1 << kPageShift;
static const size_t kMaxSize = 8u * kPageSize;
-static const size_t kAlignment = 8;
-static const size_t kLargeSizeClass = 0;
// For all span-lengths < kMaxPages we keep an exact-size list.
static const size_t kMaxPages = 1 << (20 - kPageShift);
@@ -236,6 +246,10 @@ void* MetaDataAlloc(size_t bytes);
// Requires pageheap_lock is held.
uint64_t metadata_system_bytes();
+// Adjust metadata_system_bytes to indicate that bytes are actually committed.
+// Requires pageheap_lock is held.
+void increment_metadata_system_bytes(size_t bytes);
+
// size/depth are made the same size as a pointer so that some generic
// code below can conveniently cast them back and forth to void*.
static const int kMaxStackDepth = 31;
« no previous file with comments | « third_party/tcmalloc/chromium/src/central_freelist.cc ('k') | third_party/tcmalloc/chromium/src/common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698