Fix large allocation to search optimal size class heap.
Fix arena_run_alloc_large_helper() to not convert size to usize when searching for the first best fit via arena_run_first_best_fit(). This allows the search to consider the optimal quantized size class, so that e.g. allocating and deallocating 40 KiB in a tight loop can reuse the same memory. This regression was nominally caused by5707d6f952
(Quantize szad trees by size class.), but it did not commonly cause problems until8a03cf039c
(Implement cache index randomization for large allocations.). These regressions were first released in 4.0.0. This resolves #487.
This commit is contained in:
parent
e9012630ac
commit
32896a902b
@ -1059,7 +1059,7 @@ arena_run_first_best_fit(arena_t *arena, size_t size)
|
||||
static arena_run_t *
|
||||
arena_run_alloc_large_helper(arena_t *arena, size_t size, bool zero)
|
||||
{
|
||||
arena_run_t *run = arena_run_first_best_fit(arena, s2u(size));
|
||||
arena_run_t *run = arena_run_first_best_fit(arena, size);
|
||||
if (run != NULL) {
|
||||
if (arena_run_split_large(arena, run, size, zero))
|
||||
run = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user