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

Unified Diff: content/app/content_main_runner.cc

Issue 10823205: Report memory retained by memory allocator internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replace GetProperty with GetAllocatorWasteSize Created 8 years, 2 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: content/app/content_main_runner.cc
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 13ee1bc08a6e00f0ea29090813f019ffa81b10d5..869b6121ea44371e6d88aa138e00b9025642f7a6 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) &&
darin (slow to review) 2012/10/23 17:28:30 nit: Same comment as before. We shouldn't be hard
alexeif 2012/10/23 18:00:15 I'm not sure. These strings are hardcoded in the t
+ 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);

Powered by Google App Engine
This is Rietveld 408576698