Index: content/app/content_main_runner.cc |
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc |
index 22115ced37a5837dade8ddbcc6e1cd092ea82065..3f7d0e785af5c68d2d6e35cfff54dc5c380d9575 100644 |
--- a/content/app/content_main_runner.cc |
+++ b/content/app/content_main_runner.cc |
@@ -483,8 +483,19 @@ class ContentMainRunnerImpl : public ContentMainRunner { |
} |
#if defined(USE_TCMALLOC) |
-static bool GetPropertyThunk(const char* name, size_t* value) { |
- return MallocExtension::instance()->GetNumericProperty(name, value); |
+static bool GetAllocatorWasteSizeThunk(size_t* size) { |
+ size_t heap_size, allocated_bytes, unmapped_bytes; |
+ MallocExtension* ext = MallocExtension::instance(); |
+ if (ext->GetNumericProperty("generic.heap_size", &heap_size) && |
+ ext->GetNumericProperty("generic.current_allocated_bytes", |
+ &allocated_bytes) && |
+ ext->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes", |
+ &unmapped_bytes)) { |
+ *size = heap_size - allocated_bytes - unmapped_bytes; |
+ return true; |
+ } |
+ DCHECK(false); |
+ return false; |
} |
static void GetStatsThunk(char* buffer, int buffer_length) { |
@@ -532,7 +543,8 @@ static void ReleaseFreeMemoryThunk() { |
tc_set_new_mode(1); |
// On windows, we've already set these thunks up in _heap_init() |
- base::allocator::SetGetPropertyFunction(GetPropertyThunk); |
+ base::allocator::SetGetAllocatorWasteSizeFunction( |
+ GetAllocatorWasteSizeThunk); |
base::allocator::SetGetStatsFunction(GetStatsThunk); |
base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); |