[PATCH] malloc: Fix MAX_TCACHE_SMALL_SIZE

DJ Delorie dj@redhat.com
Fri Aug 1 18:16:13 GMT 2025


On i386, doesn't this change the bit counting logic here: ?

static __always_inline size_t
large_csize2tidx(size_t nb)
{
  size_t idx = TCACHE_SMALL_BINS
	       + __builtin_clz (MAX_TCACHE_SMALL_SIZE)
	       - __builtin_clz (nb);
  return idx;
}

MAX_TCACHE_SMALL_SIZE is 1020 pre-patch, and would be 1024 post-patch...

[Runs lots of tests]

It does, but that fixes a bug where the bin between small and large
tcache didn't get used, and the 64-bit build shows no change in bin
allocations.

LGTM
Reviewed-by: DJ Delorie <dj@redhat.com>

[Looks at all his tests]

I really want to extend the malloc_info() output to include values for
all the macros and ranges for all the bins...



More information about the Libc-alpha mailing list