summaryrefslogtreecommitdiffstats
path: root/base/allocator/allocator_shim.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/allocator/allocator_shim.cc')
-rw-r--r--base/allocator/allocator_shim.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index 075828d..8728097 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_thunks.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) {
+ 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
@@ -274,6 +283,10 @@ extern "C" int _heap_init() {
tracked_objects::TIME_SOURCE_TYPE_TCMALLOC);
}
+ base::allocator::thunks::SetGetStatsFunction(get_stats_thunk);
+ base::allocator::thunks::SetReleaseFreeMemoryFunction(
+ release_free_memory_thunk);
+
return 1;
}