std::experi...fer_resource(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

🌸 NAME 🌸

okay so bestie, we're in the C++ Standard Library man page for std::experimental::pmr::monotonic_buffer_resource β€” the page title is std::experi...fer_resource(3), and the header literally spells it β€œC++ Standard Libary” (typo and all, we love that for us). This class is the main character here. πŸ’…


✨ Synopsis ✨

Defined in header <experimental/memory_resource>:

class monotonic_buffer_resource : public memory_resource;  (library fundamentals TS)

std::experimental::pmr::monotonic_buffer_resource is a special-purpose memory resource class, and its whole vibe is that it releases the allocated memory only when the resource is destroyed. It’s intended for very fast memory allocations in situations where memory is used to build up a few objects and then is released all at once β€” like, build build build, then yeet the whole thing. 🫢

You can construct monotonic_buffer_resource with an initial buffer. If there is no initial buffer, or if the buffer is exhausted, additional buffers are obtained from an upstream memory resource supplied at construction. The size of buffers obtained follows a geometric progression. No cap. ✨

🚨 vibe check: monotonic_buffer_resource is not thread-safe. That’s the warning, periodt. πŸ’€

πŸ’… Member functions πŸ’…

here’s the roster, bestie:

  • constructor β€” constructs a monotonic_buffer_resource (public member function).
  • destructor β€” destroys a monotonic_buffer_resource, releasing all allocated memory ([virtual] virtual public member function).
  • operator= β€” the copy assignment operator is deleted, so monotonic_buffer_resource is not copy assignable ([deleted] public member function).

🫢 Public member functions 🫢

  • release β€” release all allocated memory (public member function).
  • upstream_resource β€” returns a pointer to the upstream memory resource (public member function).

πŸ”’ Protected member functions πŸ”’

  • do_allocate β€” allocate memory ([virtual] virtual protected member function).
  • do_deallocate β€” no-op ([virtual] virtual protected member function).
  • do_is_equal β€” compare for equality with another memory_resource ([virtual] virtual protected member function).

🏷️ Category 🏷️

  • Noindexed pages

mwah πŸ’‹ β€” source/version is http://cppreference.com, dated 2024.06.10, and the page is std::experi...fer_resource(3). That’s the footer, folded into this cute lil sign-off. byeee πŸ¦‹

πŸ“¦ where this page comes from