std::pmr::m...ce::release(3)

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

πŸ’… NAME

std::pmr::monotonic_buffer_resource::release β€” yeah bestie, that's the whole name, stated twice in the original because they really wanted you to know πŸ’–. This page lives in the C++ Standard Libary manual (yes, that's how they spell "Libary" over there, we are not fixing it, it's iconic) β€” section (3), the library section, iykyk.


✨ Synopsis

void release();

(since C++17) 🌸

So here's the tea: release() releases all allocated memory by calling the deallocate function on the upstream memory resource, as necessary 🫢. It also resets the current buffer and the next buffer size to their initial values at construction β€” like, back to factory settings, fresh out of the box ✨.

And the important bit (fr fr, don't skip this): memory is released back to the upstream resource even if deallocate has not been called for some of the allocated blocks πŸ‘‘. Yes, even those. It doesn't care. It's cleaning house regardless πŸ’….


πŸ’€ Defect reports

The following behavior-changing defect reports were applied retroactively to previously published C++ standards 😭 (yes, they go back and patch the past, main character energy):

  • LWG 3120 β€” applied to C++17. Behavior as published: release might not make the initial buffer reusable if provided. Correct behavior: required to do so. ⭐
Ngl, this one's a glow-up: the standard said "meh, maybe" and the committee said "no babes, required." Periodt.

🫢 See also

  • deallocate β€” deallocates memory (public member function of std::pmr::memory_resource) πŸ¦‹

Okay that's the whole page bestie, go forth and release your buffers responsibly πŸŒˆπŸ’œ

http://cppreference.com Β· 2024.06.10 Β· std::pmr::m...ce::release(3) β€” mwah, that's the sign-off, ily, bye πŸŽ€

πŸ“¦ where this page comes from