Longer versionSo the situation is this. Chrome uses a wide variety of allocators, depending on the target OS and process (browser vs renderer) you get a different story.
Background context
Most of the native allocations in the renderer (read: the one not coming from the JavaScript world) today happen via PartitionAlloc. Imagine that as a drop-in replacement for malloc. However, blink these days is gradually migrating to a GC world called BlinkGC/Oilpan (you can get more context about that searching for it in blink-dev). The amount of allocations made in the renderer via TCMalloc (or any other system allocator) is marginal.
In the browser process, the situation instead is a bit different and really OS dependent. To the best of my knowledge today:
On Android: we rely on the system allocator provided by Bionic's libc (the Android framework c library) which can be either dlmalloc or jemalloc, depending on the BSP config. See
this older post of mine for more details.
On Linux Desktop: we use our own copy of TCMalloc.
On Mac: we use the system allocator, which happens to be TCMalloc (but not 100% the same version we have in Linux).
On Windows: we use mostly WinHeap.
Heap profiling in Chrome
We have an initiative called memory-infra aimed at creating memory profiling infrastructure to debug memory usage inside of Chrome. You can read about that in
this wiki page.
Very recently we started working on a heap profiler (as linked in the
doc above) to get details about allocations in Chrome.
As you can imagine form the context above, it's tricky due to the number of allocators involved.
In yesterday's canary, we released a first version of the heap profiler, which is able to give details and cluster PartitionAlloc allocations by pseudo stack traces. You can read more in this
mail thread and find instructions in
this wiki page. I didn't announce widely as it is a very bleeding edge feature (it literally landed yesterday).
More things are going to happen on this profiler side, namely: having a way to cluster allocations by object-type; being able to profile allocations also on the browser side.
About LD_PRELOAD
I think I know precisely what you are trying to do. I did it myself
here for
this Android memory profiler tool.
It is very tricky and the quick answer is that, due to the reasons explained above, it does not give a complete answer for Chrome. Intercepting malloc/free will not tell you anything at all about: the renderer process (because we use our own allocators); the browser process on Linux or Windows (where we don't use system malloc)
On top of that, is very hard to get it right (expect calls to malloc before the runtime linking is completed) and you have better chances to use existing tools (gperftools, Mac Instruments, Visual studio 2015 profiler, Android memory inspector) rather than writing your own. Even if you do a perfect job, you will still miss most of the allocations in chrome.
Without mentioning the graphics pipeline, which is a completely different story (see
this wiki page)
So, my best suggestion would be: wait for the heap profiler in chrome://tracing to happen or try one of the existing tools, don't invent your own.
The tricky part is that is very hard to create heap profiling tools that scale with Chrome's size. During loading / rendering we reach peaks of 400 K allocations per second. Be prepared to scale with that size. Most of the tools I tried choke after profiling Chrome for more than a bunch of seconds.
I hope this is enough as a first answer, but if you want to know more just ask :)