Open
Description
Reproed on x86 ChromeOS:
static mi_decl_noinline size_t mi_bin(size_t size) { // size == 248 <--------
size_t wsize = _mi_wsize_from_size(size); // wsize == 31 <--------
#if defined(MI_ALIGN4W)
if mi_likely(wsize <= 4) {
return (wsize <= 1 ? 1 : (wsize+1)&~1); // round to double word sizes
}
#elif defined(MI_ALIGN2W)
if mi_likely(wsize <= 8) { // false <--------
return (wsize <= 1 ? 1 : (wsize+1)&~1); // round to double word sizes
}
#else
if mi_likely(wsize <= 8) {
return (wsize == 0 ? 1 : wsize);
}
#endif
else if mi_unlikely(wsize > MI_LARGE_MAX_OBJ_WSIZE) { // false <--------
return MI_BIN_HUGE;
}
else {
#if defined(MI_ALIGN4W)
if (wsize <= 16) { wsize = (wsize+3)&~3; } // round to 4x word sizes
#endif
wsize--; // wsize == 30 <--------
// find the highest bit
const size_t b = (MI_SIZE_BITS - 1 - mi_clz(wsize)); // note: wsize != 0 // b == 59 <--------
// and use the top 3 bits to determine the bin (~12.5% worst internal fragmentation).
// - adjust with 3 because we use do not round the first 8 sizes
// which each get an exact bin
const size_t bin = ((b << 2) + ((wsize >> (b - 2)) & 0x03)) - 3; // bin == 233 <-------- ERROR? Non existing bin
mi_assert_internal(bin > 0 && bin < MI_BIN_HUGE);
return bin;
}
}
Metadata
Metadata
Assignees
Labels
No labels
Activity