[libcxx-commits] [libcxx] [libc++][test] Fix increasing_allocator to meet `Cpp17Allocator` requirements (PR #115671)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Nov 11 07:33:41 PST 2024
winner245 wrote:
Because I just realized that the same issue #95161 applies to `__split_buffer::shrink_to_fit`, which can increase the capacity of the underlying buffer when the allocator's `allocate_at_least` allocates more memory than requested.
I was trying to solve a different way to solve the `shrink_to_fit` issue because I think the root cause to all these `shink_to_fit` issues is that we used `allocate_at_least` instead of `allocate`. If we just revert back to `allocate`, I believe all the `shinrk_to_fit` issue would automatically be gone. This is because the standard ([[allocator.requirements]/36](https://eel.is/c++draft/allocator.requirements#general-36)) mandates that `a.allocate(n)` must allocate memory for exactly n objects of type T.
https://github.com/llvm/llvm-project/pull/115671
More information about the libcxx-commits
mailing list