[PATCH] D47111: <experimental/memory_resource>: Implement monotonic_buffer_resource.

Arthur O'Dwyer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 13 01:43:19 PDT 2018


Quuxplusone added inline comments.


================
Comment at: include/experimental/memory_resource:489
+    memory_resource* __res_;
+    size_t __next_buffer_size_;
+};
----------------
Quuxplusone wrote:
> I've discovered that Boost.Container does not bother to preserve this state across calls to `release()`. If that's legal, then we can save 8 bytes here. I've asked for an LWG issue to be opened on the subject of "what the heck is `release()` supposed to do anyway."
On discussion with Ion GaztaƱaga, Pablo Halpern, and Casey Carter, I've come to the conclusion that we *must not* preserve this state across calls to `release`, no matter what the Standard currently says, because that leads to insanely high memory usage when calling `mr.release()` in a loop. (Casey implies that MSVC's implementation has this issue; Pablo confirms that he never intended it.)

Fixed my implementation and added a regression test in `test/libcxx/experimental/memory/memory.resource.monotonic.buffer/monotonic.buffer.mem/allocate_in_geometric_progression.pass.cpp`.


Repository:
  rCXX libc++

https://reviews.llvm.org/D47111





More information about the cfe-commits mailing list