[webkit-dev] WebKit memory management?

Ariya Hidayat ariya.hidayat at trolltech.com
Mon Sep 15 02:21:31 PDT 2008


> 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).



-- 
Ariya Hidayat (ariya.hidayat at trolltech.com)
Software Engineer, Trolltech (a Nokia company)


More information about the webkit-dev mailing list