[PATCH] malloc: fix large tcache code to check for exact size match

Dev Jain dev.jain@arm.com
Thu Oct 23 09:51:24 GMT 2025


On 23/10/25 3:19 pm, Wilco Dijkstra wrote:
> Hi Dev,
>
> @@ -3280,6 +3280,8 @@ tcache_location_large (size_t nb, size_t tc_idx, bool *mangled)
> *mangled = true;
> }
> + if (te != NULL && chunksize (mem2chunk (te)) != nb)
> + return NULL;
> return tep;
>   }
>
>> But this gives a huge regression, any idea why is that? I thought checking
>> this condition in tcache_location_large itself should be the fastest.
> That is because it is used for both inserts and deletes. If you only allow it to insert if
> it finds an indentical sized block, you will never insert anything.

Ah yes, silly me! Thanks.

>
> Cheers,
> Wilco
>
>


More information about the Libc-alpha mailing list