News for hackers. Stuff that matters.
Re:Drop millions of allocations by using a linked list (2015) by cnity on Friday March 12, 2021 @07:23AM (#26435010)
malloc aligns very conservatively (because it doesn't know the size of the data you're allocating for), so there are some space gains to be had there.

AFAIK also malloc will call sbrk quite a lot, at least from my cursory reading of this musl implementation[0].

[0] https://git.musl-libc.org/cgit/musl/tree/src/malloc/malloc.c...

Re:Drop millions of allocations by using a linked list (2015) by CyberDildonics on Friday March 12, 2021 @09:06AM (#26435920)
That doesn't contain calls to sbrk at all, it maps memory in with mmap which is typical of every modern memory allocator.
Re:Drop millions of allocations by using a linked list (2015) by quantumofalpha on Friday March 12, 2021 @01:53PM (#26439404)
It uses both brk/sbrk ("__brk()" in that code) and mmap, the latter for allocating larger bits of memory. GNU libc does the same thing from what I remember from straces.
Re:Drop millions of allocations by using a linked list (2015) by cnity on Friday March 12, 2021 @09:51AM (#26436383)
You're right, I misinterpreted the calls to __brk