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

Cupertino Miranda cupertino.miranda@oracle.com
Wed Jun 4 16:31:22 GMT 2025


Hi Wilco,

>> +      size_t tc_idx = csize2tidx (nb);
>> +
>> +      if (tc_idx < TCACHE_SMALL_BINS
>> +         && tcache->entries[tc_idx] != NULL)
>> +        {
>> +         void *mem = tcache_get (tc_idx);
>>             if (__glibc_unlikely (mtag_enabled))
>> -            return tag_new_zero_region (mem, memsize (mem2chunk (mem)));
>> +           return tag_new_zero_region (mem, memsize (mem2chunk (mem)));
>> -          return clear_memory ((INTERNAL_SIZE_T *) mem, tidx2usize 
>> (tc_idx));
>> +         return clear_memory ((INTERNAL_SIZE_T *) mem, memsize 
>> (mem2chunk (mem)));
>>
>> Why remove the tidx2usize here?
> Well, previous code using tcache_index required it.
> This is an inheritance from previous version. To remove.
Oh, I miss-understood what you were suggesting. Will do.
Cannot use it on large bins thought.

Cheers,
Cupertino


More information about the Libc-alpha mailing list