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

Unified Diff: base/allocator/allocator_shim.cc

Issue 10239012: Route calls to tcmalloc MallocExtension through allocator agnostic interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate allocator_extension into own static library, add comments to allocator_extension.h Created 8 years, 8 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: base/allocator/allocator_shim.cc
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index d61a9a47ff573d183ee372e6a01b740c2bebfc59..b5686b27c02677b4a96cae97874ca600ee582c66 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -5,6 +5,7 @@
#include "base/allocator/allocator_shim.h"
#include <config.h>
+#include "base/allocator/allocator_extension.h"
#include "base/profiler/alternate_timer.h"
#include "base/sysinfo.h"
@@ -229,6 +230,14 @@ extern "C" intptr_t _get_heap_handle() {
return 0;
}
+static void get_stats_thunk(char* buffer, int buffer_length) {
willchan no longer on Chromium 2012/04/26 22:08:48 CamelCase naming.
+ MallocExtension::instance()->GetStats(buffer, buffer_length);
+}
+
+static void release_free_memory_thunk() {
+ MallocExtension::instance()->ReleaseFreeMemory();
+}
+
// The CRT heap initialization stub.
extern "C" int _heap_init() {
#ifdef ENABLE_DYNAMIC_ALLOCATOR_SWITCHING
@@ -273,6 +282,9 @@ extern "C" int _heap_init() {
tcmalloc::ThreadCache::GetBytesAllocatedOnCurrentThread);
}
+ base::allocator::SetGetStatsFunction(get_stats_thunk);
+ base::allocator::SetReleaseFreeMemoryFunction(release_free_memory_thunk);
+
return 1;
}

Powered by Google App Engine
This is Rietveld 408576698