|
|
Log in / Subscribe / Register

Yay for Clang

Yay for Clang

Posted Jan 27, 2026 0:48 UTC (Tue) by turistu (guest, #164830)
In reply to: Yay for Clang by josh
Parent article: GNU C Library 2.43 released

> Also, the usual memory pressure behaviour of long-running systemd services has no effect on musl.

Can someone explain what they're trying to say in that hedged, convoluted statement?

Is it that musl's free(3) never ends up calling brk(2) or munmap(2) to actually release the freed up memory?


to post comments

Yay for Clang

Posted Jan 27, 2026 8:05 UTC (Tue) by mchapman (subscriber, #66589) [Link] (1 responses)

Under memory pressure, systemd's daemons call malloc_trim to ask the C library to release unused heap space. This function isn't implemented by Musl.

It might be the case that Musl doesn't need it. But I think that would mean it would be mapping and unmapping single pages at a time, which doesn't seem likely.

Yay for Clang

Posted Jan 27, 2026 11:44 UTC (Tue) by wahern (subscriber, #37304) [Link]

musl does return memory to the kernel. See free at https://git.musl-libc.org/cgit/musl/tree/src/malloc/mallo... I haven't read closely enough to really understand the heuristics, or the general architecture for that matter, but off-the-cuff I'd guess it's pretty aggressive, but not stupid aggressive. It shouldn't be too difficult to explore. The code is incredibly short compared to ptmalloc, etc; not just free.c, but all of mallocng/.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds