[webkit-help] What is the purpose of WTF::OSAllocator and WTF::fastMalloc in Webkit?

Konstantin Tokarev annulen at yandex.ru
Fri Dec 9 02:31:12 PST 2016

09.12.2016, 12:28, "fdgfd gfdgfdg" <probablynotthebestone at gmail.com>:
> There are two ways webkit gets memory using mmap from the operating system, one is WTF::OSAllocator and the second one is WTF::fastMalloc which seems to rely on tcmalloc to get memory from os. I'm using qt bindings. What is the purpose of each of them ?

OSAllocator has Usage enum in the beginning of its declaration, it lists primary cases where OSAllocator is used. Generally speaking, OSAllocator is used for large-sized allocations with sizes comparable to OS memory pages (typically 4K)

On the contrary, fastMalloc is used for smaller allocations, it's most common usage is WTF_MAKE_FAST_ALLOCATED macro which declares new and delete operators in a large number of classes, e.g. WebCore::Node.

> I'm using qt bindings. 

You should better switch to [1], it's much closer to the modern WebKit, see [2] for more details.

In particular, tcmalloc is not used for a long time, it was superceeded by bmalloc. Since then, some usages of OSAllocator were replaced with bmalloc/fastMalloc

[1] https://github.com/annulen/webkit
[2] http://qtwebkit.blogspot.com/2016/08/qtwebkit-im-back.html

> ,
> _______________________________________________
> webkit-help mailing list
> webkit-help at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-help


More information about the webkit-help mailing list