|
|
Log in / Subscribe / Register

Yay for Clang

Yay for Clang

Posted Jan 27, 2026 8:05 UTC (Tue) by mchapman (subscriber, #66589)
In reply to: Yay for Clang by turistu
Parent article: GNU C Library 2.43 released

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.


to post comments

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