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

Unified Diff: webkit/glue/webkitplatformsupport_impl.cc

Issue 10823205: Report memory retained by memory allocator internals. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix a typo. Created 8 years, 4 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 | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webkitplatformsupport_impl.cc
diff --git a/webkit/glue/webkitplatformsupport_impl.cc b/webkit/glue/webkitplatformsupport_impl.cc
index fe80547877be6ca318df6f55d462bcbcbba6903c..3ff674f8635d684b31f05f9d68f79a513cff70f9 100644
--- a/webkit/glue/webkitplatformsupport_impl.cc
+++ b/webkit/glue/webkitplatformsupport_impl.cc
@@ -48,6 +48,10 @@
#include "webkit/plugins/npapi/plugin_instance.h"
#include "webkit/plugins/webplugininfo.h"
+#if defined(USE_TCMALLOC)
+#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
+#endif
+
#if defined(OS_LINUX)
#include "v8/include/v8.h"
#endif
@@ -758,6 +762,37 @@ bool WebKitPlatformSupportImpl::processMemorySizesInBytes(
return CurrentProcessMetrics()->GetMemoryBytes(private_bytes, shared_bytes);
}
+bool WebKitPlatformSupportImpl::memoryAllocatorWasteInBytes(size_t* psize) {
darin (slow to review) 2012/08/07 22:06:14 nit: avoid Hungarian notation... psize -> size
alexeif 2012/08/08 17:18:36 Done.
+#if defined(USE_TCMALLOC)
jamesr 2012/08/07 22:15:59 having defined(USE_TCMALLOC) set does not mean tha
alexeif 2012/08/08 17:18:36 done it in a separate CL https://chromiumcoderevie
+ MallocExtension* malloc_ext = MallocExtension::instance();
darin (slow to review) 2012/08/07 22:06:14 nit: indentation
alexeif 2012/08/08 17:18:36 Done.
+ DCHECK(malloc_ext);
+ std::vector<MallocExtension::FreeListInfo> free_list_info;
+ malloc_ext->GetFreeListSizes(&free_list_info);
+ size_t size = 0;
+ std::vector<MallocExtension::FreeListInfo>::iterator it;
+ for (it = free_list_info.begin(); it != free_list_info.end(); ++it) {
+#ifdef NDEBUG
+ if (it->total_bytes_free == 0)
+ continue;
+#endif
+ if (strcmp(it->type, "tcmalloc.central") == 0 ||
+ strcmp(it->type, "tcmalloc.transfer") == 0 ||
+ strcmp(it->type, "tcmalloc.thread") == 0 ||
+ strcmp(it->type, "tcmalloc.large") == 0 ||
+ strcmp(it->type, "tcmalloc.page") == 0) {
+ size += it->total_bytes_free;
+ continue;
+ }
+ DCHECK(strcmp(it->type, "tcmalloc.large_unmapped") == 0 ||
+ strcmp(it->type, "tcmalloc.page_unmapped") == 0);
+ }
+ *psize = size;
+ return true;
+#else
+ return false;
+#endif
+}
+
void WebKitPlatformSupportImpl::SuspendSharedTimer() {
++shared_timer_suspended_;
}
« no previous file with comments | « webkit/glue/webkitplatformsupport_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698