[PATCH v7 1/2] malloc: add tcache support for large chunk caching

Wilco Dijkstra Wilco.Dijkstra@arm.com
Wed May 28 17:02:38 GMT 2025


Hi Cupertino,

> +  else if (bytes < mp_.tcache_max_bytes)
>       {
>         tc_idx = large_csize2tidx (bytes);
>         if (tc_idx < mp_.tcache_bins)
> 
> The function large_csize2tidx is only called by tcache_index.
> There is also another detail, that the value in mp_.tcache_max_bytes
> needs to become the chunk size and not allocation size.
> mp_.tcache_max_bytes is not used anywhere else, either.

That should work indeed, and it would fix the other issue with a large
mp_.tcache_bins being used on the small bins if we stop it from being
larger than the number of small bins. It also means you can remove the
tc_idx < mp_.tcache_bins check above.

Cheers,
Wilco


More information about the Libc-alpha mailing list