How to profile memory inside PartitionAlloc allocations?

135 views
Skip to first unread message

Aleks Totic

unread,
Mar 27, 2019, 3:02:34 AM3/27/19
to Chromium-dev
I am profiling Chrome's memory usage using tc_malloc heap profiler and pprof.

This only shows allocations in the default tc_malloc heap. All the good stuff, LayoutObjects, etc, are not shown.

Is there a way to profile PartitionAlloc partitions too? I am ok with turning off PartitionAlloc for profiling, I am not interested in speed, just raw memory usage.

Aleks


Vlad Tsyrklevich

unread,
Mar 27, 2019, 3:50:52 AM3/27/19
to ato...@google.com, Chromium-dev
Chrome's heap profiler uses base::PartitionAllocHooks to inspect
allocations. Depending on what you're doing you may be able to use the
Chrome's built-in heap profiling, use the same hooks, or you could
also try defining MEMORY_TOOL_REPLACES_ALLOCATOR for just
base/allocator/partition_allocator/ to have those allocations fall
through to malloc/free.
> --
> --
> Chromium Developers mailing list: chromi...@chromium.org
> View archives, change email options, or unsubscribe:
> http://groups.google.com/a/chromium.org/group/chromium-dev
> ---
> You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAMdyzDuqTs_gM7AxB%3DZnTCmq1uKN2hX%3DsknJGN1M0W2M9B6iQQ%40mail.gmail.com.

Aleks Totic

unread,
Mar 27, 2019, 6:17:14 PM3/27/19
to Vlad Tsyrklevich, Chromium-dev
I ended up with a single line code change that made PartitionAlloc use tc_malloc.

--- a/base/allocator/partition_allocator/partition_alloc.h
+++ b/base/allocator/partition_allocator/partition_alloc.h
 +#define MEMORY_TOOL_REPLACES_ALLOCATOR 1

I was able to get memory profile with all the allocations. 
This, combined with pprof was very helpful in trying to understand total memory usage.

Aleks
Reply all
Reply to author
Forward
0 new messages