[libcxx-commits] [libcxx] [libcxx] Align allocation to match `__set_long_cap` and `__get_long_cap` (PR #90292)

James Y Knight via libcxx-commits libcxx-commits at lists.llvm.org
Mon Apr 29 05:52:45 PDT 2024


jyknight wrote:

We pass the capacity directly to deallocate, e.g.:
```
  inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string() {
    __annotate_delete();
    if (__is_long())
      __alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
  }
```
and for sized-delete, we are required to pass the _actual_ size that was passed to allocate, not a rounded amount.

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


More information about the libcxx-commits mailing list