On 03/06/2008, at 21:13, Paul Pedriana wrote:
Thanks for the info. IMHO, tcmalloc is not appropriate for console, embedded, and mobile platforms. It trades space for speed, and that'sthe opposite of what you want outside the desktop. This is why the NokiaS60 people replaced tcmalloc, for example.
As far as I can tell, Nokia's S60 port predates the adoption of tcmalloc by WebKit. The code in their latest svn.webkit.org source tree contains a variant of dlmalloc that was used up until Safari 2.0, though I have not checked to see whether it is compiled in to their build. That said, it is obvious that the space vs. speed tradeoffs differ between devices, and that flexibility in the memory allocator used is desirable.
Unfortunately, overriding operator new and delete does not do the rightthing. These operators are application-global functions and when you redirect them for one library you are thus redirecting them for theentire rest of the app. Needless to say, that is a bad thing. In consoleand embedded development, as I note in the aforementioned paper, it is typically verboten for a library to use operator new/delete.
On the platforms with which I am familiar, the implementation that I linked to has no effect outside of the library in which it is defined. I've not worked with consoles or embedded devices so the toolchain and environment may differ there, but I would be a little surprised to see an inline function that is implemented in a header become visible to an object file that did not include the header.
Neither will you see professional commercial software do this.
It's also a problem to have any calls to system malloc at all, because often onthese platforms there is little or no memory available, as theapplication has taken it all to distribute to private heaps as per theirbudget.
The direct calls are few and far between. They can easily be evaluated to determine which, if any, have a legitimate need to call the system allocator and the remainder updated to use "fastMalloc" / "fastFree". I'd gladly review a patch that moves in this direction.
One simple and effective way to solve this problem is to provide a memory config header file which defines macros or templates which replace new/delete, malloc/free. Instead of calling global new, WC_NEW (e.g.) is called instead.
How does this differ from FastMalloc.h and "fastMalloc" / "fastFree" that I described in my previous email, other than addressing the perceived problem with "operator new" / "operator delete"?
This is how commercial-quality software is done
Kind regards, Mark Rowe
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev