[webkit-help] WebKit Memory Management

Ariya Hidayat ariya.hidayat at gmail.com
Wed Sep 23 06:27:49 PDT 2009

> Can someone explain briefly on how WebKit manages dynamic memory
> allocations? And whether it’s possible to limit the memory WebKit uses?

Grep for 'FastMalloc'. Also check webkit-dev, there were discussions
and work-in-progress to allow better/fine-grained control of memory

> And I’ve also verified that the internal cache is disabled (by doing
> Cache::dumpStats()), however the memory utilization would keep growing while
> we click through random pages starting from google (e.g. www.google.com,
> click on news, click on the first news page, etc). The allocated memory
> however, would stabilize after it reaches about 53MB, suggesting some kind
> of limitation/recycling mechanism kicking in.
> P.S. The allocated memory data was retrieved from mallinfo.arena
> (http://docs.sun.com/app/docs/doc/816-5168/mallinfo-3malloc?a=view), and
> we’ve ruled out the possibility that the application code itself is leaking.

While this information is useful, it does not help us if it can't
pinpoint what the cause for the allocation. As an illustration, when I
tried to reduce the peak memory consumption of QtWebKit, I did use
Valgrind's Massif to locate the offending function. After that, it was
fairly easy to fix it.

Ariya Hidayat

More information about the webkit-help mailing list