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

Unified Diff: third_party/tcmalloc/chromium/src/page_heap.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
Index: third_party/tcmalloc/chromium/src/page_heap.h
diff --git a/third_party/tcmalloc/chromium/src/page_heap.h b/third_party/tcmalloc/chromium/src/page_heap.h
index 603e65a09dcec86f7a1fd773b5f2e80976100242..ab7a5414bb71c66129b2ae1f48d604171660ac07 100644
--- a/third_party/tcmalloc/chromium/src/page_heap.h
+++ b/third_party/tcmalloc/chromium/src/page_heap.h
@@ -76,6 +76,8 @@ namespace tcmalloc {
// -------------------------------------------------------------------------
// We use PageMap2<> for 32-bit and PageMap3<> for 64-bit machines.
+// ...except...
+// On Windows, we use TCMalloc_PageMap1_LazyCommit<> for 32-bit machines.
// We also use a simple one-level cache for hot PageID-to-sizeclass mappings,
// because sometimes the sizeclass is all the information we need.
@@ -89,7 +91,13 @@ template <int BITS> class MapSelector {
// A two-level map for 32-bit machines
template <> class MapSelector<32> {
public:
+#ifdef WIN32
+// A flat map for 32-bit machines (with lazy commit of memory).
+ typedef TCMalloc_PageMap1_LazyCommit<32-kPageShift> Type;
+#else
+ // A two-level map for 32-bit machines
typedef TCMalloc_PageMap2<32-kPageShift> Type;
+#endif
typedef PackedCache<32-kPageShift, uint16_t> CacheType;
};
@@ -150,6 +158,8 @@ class PERFTOOLS_DLL_DECL PageHeap {
uint64_t system_bytes; // Total bytes allocated from system
uint64_t free_bytes; // Total bytes on normal freelists
uint64_t unmapped_bytes; // Total bytes on returned freelists
+ uint64_t committed_bytes; // Bytes committed, always <= system_bytes_.
+
};
inline Stats stats() const { return stats_; }
void GetClassSizes(int64 class_sizes_normal[kMaxPages],
@@ -198,11 +208,13 @@ class PERFTOOLS_DLL_DECL PageHeap {
// Never delay scavenging for more than the following number of
// deallocated pages. With 4K pages, this comes to 4GB of
// deallocation.
- static const int kMaxReleaseDelay = 1 << 20;
+ // Chrome: Changed to 64MB
+ static const int kMaxReleaseDelay = 1 << 14;
// If there is nothing to release, wait for so many pages before
// scavenging again. With 4K pages, this comes to 1GB of memory.
- static const int kDefaultReleaseDelay = 1 << 18;
+ // Chrome: Changed to 16MB
+ static const int kDefaultReleaseDelay = 1 << 12;
// Pick the appropriate map and cache types based on pointer size
typedef MapSelector<kAddressBits>::Type PageMap;
@@ -226,7 +238,6 @@ class PERFTOOLS_DLL_DECL PageHeap {
// Statistics on system, free, and unmapped bytes
Stats stats_;
-
Span* SearchFreeAndLargeLists(Length n);
bool GrowHeap(Length n);
@@ -255,6 +266,12 @@ class PERFTOOLS_DLL_DECL PageHeap {
// appropriate free list, and adjust stats.
void MergeIntoFreeList(Span* span);
+ // Commit the span.
+ void CommitSpan(Span* span);
+
+ // Decommit the span.
+ void DecommitSpan(Span* span);
+
// Prepends span to appropriate free list, and adjusts stats.
void PrependToFreeList(Span* span);
« no previous file with comments | « third_party/tcmalloc/chromium/src/packed-cache-inl.h ('k') | third_party/tcmalloc/chromium/src/page_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698