std::pmr::u...ol_resource(3)
Okay so this is the std::pmr::u...ol_resource(3) page from the C++ Standard Library manual, bestie, and we're talking about the absolutely iconic std::pmr::unsynchronized_pool_resource π
π NAME π
std::pmr::unsynchronized_pool_resource β yes, that's the class, and the page title is std::pmr::u...ol_resource(3). Periodt π
β¨ Synopsis β¨
Defined in header <memory_resource>
class unsynchronized_pool_resource : public
std::pmr::memory_resource;
This class is since C++17 π«Ά
std::pmr::unsynchronized_pool_resource is a general-purpose memory resource class with these properties, and no we are not skipping any of them:
- It owns the allocated memory and frees it on destruction, even if
deallocatehas not been called for some of the allocated blocks. It's giving responsible main character energy π - It consists of a collection of pools that serves requests for different block sizes. Each pool manages a collection of chunks that are then divided into blocks of uniform size π§
- Calls to
do_allocateare dispatched to the pool serving the smallest blocks accommodating the requested size. So it's matching your request to the smallest block that fits, lowkey efficient β¨ - Exhausting memory in the pool causes the next allocation request for that pool to allocate an additional chunk of memory from the upstream allocator to replenish the pool. The chunk size obtained increases geometrically π
- Allocation requests that exceed the largest block size are served from the upstream allocator directly. No pool for those, they go straight upstairs π
- The largest block size and maximum chunk size may be tuned by passing a
std::pmr::pool_optionsstruct to its constructor ποΈ
Okay bestie, important vibe check:unsynchronized_pool_resourceis not thread-safe, and cannot be accessed from multiple threads simultaneously; usesynchronized_pool_resourceif access from multiple threads is required. Do not play yourself π
π Member functions π
constructorβ constructs anunsynchronized_pool_resource(public member function)destructor[virtual]β destroys anunsynchronized_pool_resource, releasing all allocated memory (virtual public member function)operator=[deleted]β copy assignment operator is deleted.unsynchronized_pool_resourceis not copy assignable (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)optionsβ returns the options that control the pooling behavior of this resource (public member function)
π¦ Protected member functions π¦
do_allocate[virtual]β allocate memory (virtual protected member function)do_deallocate[virtual]β return memory to the pool (virtual protected member function)do_is_equal[virtual]β compare for equality with anotherstd::pmr::memory_resource(virtual protected member function)
Source/version and date vibes, bestie: http://cppreference.com, dated 2024.06.10, and the footer title is std::pmr::u...ol_resource(3). Bye bestie π«Άπ
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms