[patch v4] malloc: avoid need for tcache == NULL checks

Florian Weimer fweimer@redhat.com
Mon Sep 8 05:38:59 GMT 2025


* DJ Delorie:

>> hence I don't like all the on-demand initializations.
>
> We have to, because tunables.

I doubt that there's harm in having unused 512 bytes (or so) in the TCB
if tcache has been disabled via tunable.

The larger problem is that we can't have 512 bytes of static TLS per
libc.so after dlmopen, at least not on 32-bit architectures.  With the
16 namespaces, that's 8 KiB.

Maybe we could replace the “is tcache initialized” flag with a
__libc_initial check and keep the tcache directly in the TCB.  Getting
rid of this conditional check requires IFUNCs for the malloc
entrypoints.

Thanks,
Florian



More information about the Libc-alpha mailing list