[webkit-dev] WebKit memory management?
Mike Hommey
mh+webkit at glandium.org
Mon Sep 15 04:31:33 PDT 2008
On Mon, Sep 15, 2008 at 11:21:31AM +0200, Ariya Hidayat <ariya.hidayat at trolltech.com> wrote:
>
> > our goal is to change standard malloc to tcmalloc under linux-qt port but
> > we couldn't solve operator new and delete problems. As we see Paul's (
> > https://bugs.webkit.org/show_bug.cgi?id=20422 ) solution can
> > solve this, therefore if the community accepts this change then we would
> > gladly help to replace all new and delete operators to the new ones.
>
> Because typically we build QtWebKit as a shared library, this raises the
> problem that the overloaded new/delete will be global, i.e. this would also
> affects the application that links QtWebKit, so not only at the library level
> (QtWebKit).
>
> The mentioned patch seems to solve this problem, but at the cost of reduced
> syntax readability because we can't use the familiar C++ new/delete
> constructs anymore (AFAICS we are not even allowed to use it anymore). I
> wonder whether this is a good compromise, i.e. what justifies it more than
> just providing the new/delete override at the application (I wasn't involved
> in previous memory management discussions before, so please point out what I
> miss here).
>
> Side note: we found out that the Linux's standard malloc is good enough,
> enabling the JSC's (tcmalloc-based) FastMalloc does not add any significant
> speed boost. This is however different on QtWebKit/Win32, where FastMalloc
> improves SunSpider by 30%.
>
> (Of course I might be wrong here, so feel free to provide corrections).
It might be beneficial on long term use, where memory allocation/deallocation
will have created fragmentation, making the process need a lot of virtual
memory because it can't fill the holes, making the whole thing be a memory
hog. Tcmalloc has usually less fragmentation.
Mike
More information about the webkit-dev
mailing list