[libcxx-commits] [PATCH] D93071: [libc++] NFCI: Implement make_shared as allocate_shared with std::allocator

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Dec 10 15:34:07 PST 2020


ldionne added a comment.

In D93071#2447273 <https://reviews.llvm.org/D93071#2447273>, @mclow.lists wrote:

> In D93071#2447271 <https://reviews.llvm.org/D93071#2447271>, @mclow.lists wrote:
>
>> if you allocate memory with an allocator, you need to deallocate it with the same allocator. Not with `operator delete`
>
> There's a good chance that this is a pre-existing problem.

Indeed, however `std::allocator` is specified to use `operator new` and `operator delete`. Also, we already did allocate using `std::allocator<>::allocate` and our control block already deallocates using the provided allocator's `deallocate` function, so the `allocate` and `deallocate` calls are matched (both before and after the patch).


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93071/new/

https://reviews.llvm.org/D93071



More information about the libcxx-commits mailing list