summaryrefslogtreecommitdiffstats
path: root/content/app
diff options
context:
space:
mode:
authoralexeif@chromium.org <alexeif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-07 12:19:51 +0000
committeralexeif@chromium.org <alexeif@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-07 12:19:51 +0000
commit3b875959cf00fdb428911f1877582c2ed1322782 (patch)
tree6372435b76779d4071e7275aff908c54a52ae615 /content/app
parent6e1a7d3974d7e13d66bd5d829e12a3e0a5912289 (diff)
downloadchromium_src-3b875959cf00fdb428911f1877582c2ed1322782.zip
chromium_src-3b875959cf00fdb428911f1877582c2ed1322782.tar.gz
chromium_src-3b875959cf00fdb428911f1877582c2ed1322782.tar.bz2
Report memory usage retained by TCMalloc freelists.
Review URL: https://chromiumcodereview.appspot.com/10823205 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171767 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r--content/app/content_main_runner.cc18
1 files changed, 15 insertions, 3 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index a74e7b6..463d0ec 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -485,8 +485,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) {
@@ -534,7 +545,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);