Index: base/trace_event/malloc_dump_provider.cc |
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc |
index 5279ab0c6e64445b8815a2f5f575ee8c76a4c845..3a6de48e1cdef20b3543de400f306c9cb47f6da6 100644 |
--- a/base/trace_event/malloc_dump_provider.cc |
+++ b/base/trace_event/malloc_dump_provider.cc |
@@ -10,7 +10,7 @@ |
#include <malloc.h> |
#endif |
-#include "base/allocator/allocator_extension_thunks.h" |
+#include "base/allocator/allocator_extension.h" |
#include "base/trace_event/process_memory_dump.h" |
namespace base { |
@@ -42,30 +42,26 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args, |
total_virtual_size = stats.size_allocated; |
resident_size = stats.size_in_use; |
allocated_objects_size = stats.size_in_use; |
+#elif defined(USE_TCMALLOC) |
+ bool res = |
+ allocator::GetNumericProperty("generic.heap_size", &total_virtual_size); |
+ DCHECK(res); |
+ res = allocator::GetNumericProperty("generic.total_physical_bytes", |
+ &resident_size); |
+ DCHECK(res); |
+ res = allocator::GetNumericProperty("generic.current_allocated_bytes", |
+ &allocated_objects_size); |
+ DCHECK(res); |
#else |
- allocator::thunks::GetNumericPropertyFunction get_property_function = |
- allocator::thunks::GetGetNumericPropertyFunction(); |
- if (get_property_function) { |
- // If the function is not null then tcmalloc is used. See |
- // MallocExtension::getNumericProperty. |
- bool res = get_property_function("generic.heap_size", &total_virtual_size); |
- DCHECK(res); |
- res = get_property_function("generic.total_physical_bytes", &resident_size); |
- DCHECK(res); |
- res = get_property_function("generic.current_allocated_bytes", |
- &allocated_objects_size); |
- DCHECK(res); |
- } else { |
- struct mallinfo info = mallinfo(); |
- DCHECK_GE(info.arena + info.hblkhd, info.uordblks); |
+ struct mallinfo info = mallinfo(); |
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks); |
- // In case of Android's jemalloc |arena| is 0 and the outer pages size is |
- // reported by |hblkhd|. In case of dlmalloc the total is given by |
- // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. |
- total_virtual_size = info.arena + info.hblkhd; |
- resident_size = info.uordblks; |
- allocated_objects_size = info.uordblks; |
- } |
+ // In case of Android's jemalloc |arena| is 0 and the outer pages size is |
+ // reported by |hblkhd|. In case of dlmalloc the total is given by |
+ // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. |
+ total_virtual_size = info.arena + info.hblkhd; |
+ resident_size = info.uordblks; |
+ allocated_objects_size = info.uordblks; |
#endif |
MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc"); |