[libcxx-commits] [libcxx] [libc++][vector] Fixes shrink_to_fit. (PR #97895)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 16 11:01:07 PDT 2024


mordante wrote:

> What we'd really like is a way to ask the allocator for _at most_ n bytes. That way the allocator could instead report that it can only give us more than n bytes, and we'd likely prevent the system allocator from having to do additional work.

That is what `allocate` does, but that secretly throws away bytes. I expect the case where the allocator gives more bytes would be rare, the arena allocator in the example seems a good example.



https://github.com/llvm/llvm-project/pull/97895


More information about the libcxx-commits mailing list