[PATCH] malloc: fix large tcache code to check for exact size match
Wilco Dijkstra
Wilco.Dijkstra@arm.com
Thu Oct 23 09:49:00 GMT 2025
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.
Cheers,
Wilco
More information about the Libc-alpha
mailing list