[webkit-dev] WebKit memory management?

Arvid Nilsson arvid.nilsson at venatech.se
Mon Sep 15 03:29:04 PDT 2008


If I understand Mr. Pedriana correctly, you are incorrect in assuming that
we would get "reduced syntax readability". You may use the regular "new"
syntax that C++ programmers are accustomed to when allocating objects and
arrays of objects that inherit from AllocBase. Pedriana proposes that we
eventually add AllocBase as the base class of all root classes in WebKit,
thus making AllocBase the only root class.

The only time when you would need to use newObject/newArray is for some
stray new/new[] calls when allocating something that does not inherit from
AllocBase, i.e. a simple datatype.
BR,

Arvid
On Mon, Sep 15, 2008 at 11:21 AM, 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).
>
>
>
> --
> Ariya Hidayat (ariya.hidayat at trolltech.com)
> Software Engineer, Trolltech (a Nokia company)
>  _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.webkit.org/pipermail/webkit-dev/attachments/20080915/167b0dfd/attachment.html 


More information about the webkit-dev mailing list