This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix tcache count maximum
Hi Carlos,
> Char's sign is implementation defined.
>
> So it's not a serious bug, but it's a non-portable assumption we should fix.
>
> I don't know if gcc makes the sign of char vary by architecture or not.
Char can be signed or unsigned per target, so that means portable code using
char can only use the intersection of the signed and unsigned ranges safely
(unless you only use equality so signedness is irrelevant).
> When you extend the counts will you need to update the size estimates?
>
> glibc/manual/tunables.texi:
>
> 195 The approximate maximum overhead of the per-thread cache is thus equal
> 196 to the number of bins times the chunk count in each bin times the size
> 197 of each chunk. With defaults, the approximate maximum overhead of the
> 198 per-thread cache is approximately 236 KB on 64-bit systems and 118 KB
> 199 on 32-bit systems.
> 200 @end deftp
That is the maximum size of the blocks contained in the tcache, not the size
overhead of the tcache datastructure itself. My original change would add just 64
bytes, but even if we made the count array a size_t, it would add 448 bytes on a
64-bit target, ie. a tiny fraction of the maximum tcache size of 236KB.
Wilco