[webkit-dev] WebKit memory instrumentation

Allan Sandfeld Jensen kde at carewolf.com
Tue Jul 24 11:30:22 PDT 2012


Hi

This is very interesting. I have been trying to debug memory-comsumption 
lately as well, though I have used different methods:

I guess this API is to make the data available in web-inspector right? 
I have gathered similar data using valgrind's massif which can tell you which 
objects have been allocated, when and where and how much memory they use, but 
massif is very slow and can require some perl-processing afterwards to get 
good data out off.

Lately though, I have been using a different system. like many undocumented 
secrets in WebKit, there are a series of memory statistics functions for the 
various memory subsystems. Take a look at 
Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm for some examples of what it 
can tell you.

It doesn't tell you how large the elements of the render-tree are, but the 
render-tree is not that that significant anymore, but it tells you how much is 
allocated for JavaScript heap, stack or pre-compiled code separetely, and how 
much is used by various caches, and how much can be garbage-collected if you 
have a memory pressure handler to trigger it. This has been very useful to me 
at least.

I can see how this new system is more powerful, but I can not help to feel it 
is somehow doing the wrong thing at the wrong place.

Best Regards
`Allan Sandfeld


More information about the webkit-dev mailing list