diff --git a/src/mem/allocstats.h b/src/mem/allocstats.h index 5519985..7b68ae7 100644 --- a/src/mem/allocstats.h +++ b/src/mem/allocstats.h @@ -141,7 +141,9 @@ namespace snmalloc UNUSED(size); #ifdef USE_SNMALLOC_STATS - bucketed_requests[bits::to_exp_mant(size)]++; + auto index = (size == 0) ? 0 : bits::to_exp_mant(size); + assert(index < TOTAL_BUCKETS); + bucketed_requests[index]++; #endif }