https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118681

--- Comment #4 from Diego Ramirez <dieram3 at gmail dot com> ---
I think the way to fix this is finding the the first pool block size `B` such
as `B >= size` and `B & (alignment - 1) == 0` (or in other words `gcd(B,
alignment) == alignment)`).

The starting point in `pool_sizes` would be found with `lower_bound(pool_sizes,
max(size, alignment))`, and then we'd do a linear search. I see that in
`pool_sizes`, powers of 2 are at most 4 elements apart (256 to 512), so the
linear search would be 4 iterations in the worse case.

Another option would be to change the pool block sizes, but that seems like a
bigger endeavor.

Reply via email to