
Understanding glibc malloc - ingve
https://sploitfun.wordpress.com/2015/02/10/understanding-glibc-malloc/
======
rurban
Old discussion:
[https://news.ycombinator.com/item?id=9327526](https://news.ycombinator.com/item?id=9327526)

And he forgot ptmalloc3, the improved version of the glibc malloc.

~~~
teddyh
Who wrote ptmalloc3 – the original writer of ptmalloc2, or is it an
independent creator who simply decided to call their fork “ptmalloc3”? In what
way is it better? Why haven’t GNU libC converted to ptmalloc3?

~~~
rurban
Ad #1: yes, wolfram gloger.

Ad #2: ptmalloc3 biggest advantage over dlmalloc 2.8.3 is for multiple
threads, while trying to avoid lockcontention as much as possible. But it also
has e.g. a better API to support slabs and array or struct elements via
independent_comalloc(), which speeds up my compiled code by 20%. You can alloc
your elements in once and still individually free them.

See the malloc-2.8.3.h header:
[https://code.qt.io/cgit/qt/qt.git/tree/src/3rdparty/ptmalloc...](https://code.qt.io/cgit/qt/qt.git/tree/src/3rdparty/ptmalloc/malloc-2.8.3.h#n214)

Ad #3: memory usage. ptmalloc2 has the least overhead. In my case with lots of
arrays which can be independent_comalloc'ed this is not observable.

------
cyphar
Referring to the "Linux allocator" is confusing, since the Linux kernel also
has allocators. Saying he "GNU/Linux allocator" or the "glibc allocator" would
be more correct and respectful.

