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

Unified Diff: base/trace_event/malloc_dump_provider.cc

Issue 2163783003: Implement a ScopedThreadHeapUsage class to allow profiling per-thread heap usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shim-default
Patch Set: Fix memory leak found by ASAN bot. Created 4 years, 3 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/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 d7732aba664ebf38532d247c562c1df98ebe62e2..0258386deb3e527d93492a95391e425e6775430b 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -77,13 +77,21 @@ void HookFree(const AllocatorDispatch* self, void* address) {
next->free_function(next, address);
}
+size_t HookGetSizeEstimate(const AllocatorDispatch* self, void* address) {
+ const AllocatorDispatch* const next = self->next;
+ if (!next->get_size_estimate_function)
Primiano Tucci (use gerrit) 2016/09/07 17:53:38 not sure we need this level of protection here rig
Sigurður Ásgeirsson 2016/09/07 18:35:35 Done.
+ return 0;
+ return next->get_size_estimate_function(next, address);
+}
+
AllocatorDispatch g_allocator_hooks = {
- &HookAlloc, /* alloc_function */
- &HookZeroInitAlloc, /* alloc_zero_initialized_function */
- &HookllocAligned, /* alloc_aligned_function */
- &HookRealloc, /* realloc_function */
- &HookFree, /* free_function */
- nullptr, /* next */
+ &HookAlloc, /* alloc_function */
+ &HookZeroInitAlloc, /* alloc_zero_initialized_function */
+ &HookllocAligned, /* alloc_aligned_function */
+ &HookRealloc, /* realloc_function */
+ &HookFree, /* free_function */
+ &HookGetSizeEstimate, /* get_size_estimate_function */
+ nullptr, /* next */
};
#endif // BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM)
« base/debug/scoped_thread_heap_usage.cc ('K') | « base/debug/scoped_thread_heap_usage_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698