std::experi...ol_resource(3)
okay bestie, welcome to the std::experi...ol_resource(3) page from the C++ Standard Libary manual πβ¨
πΈ NAME πΈ
std::experimental::pmr::synchronized_pool_resource β yes, the whole long iconic name, no notes π
β¨ Synopsis β¨
Defined in header <experimental/memory_resource>.
class synchronized_pool_resource : public memory_resource;
and yes, itβs part of the (library fundamentals TS) π«Ά
So std::experimental::pmr::synchronized_pool_resource is a general-purpose memory resource class with these properties, periodt:
- It owns the allocated memory and frees it on destruction, even if
deallocatehas not been called for some of the allocated blocks. - It consists of a collection of pools that serves request 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. - 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.
- The largest block size and maximum chunk size may be tuned by passing a
std::experimental::pmr::pool_optionsstruct to its constructor.
<pink>synchronized_pool_resource</pink> may be accessed from multiple threads without external synchronization, and may have thread-specific pools to reduce synchronization costs. If the memory resource is only accessed from one thread, unsynchronized_pool_resource is more efficient. iykyk π
π Member functions π
constructorβ constructs asynchronized_pool_resource(public member function).destructor[virtual]β destroys asynchronized_pool_resource, releasing all allocated memory (virtual public member function).operator=[deleted]β copy assignment operator is deleted.synchronized_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 anothermemory_resource(virtual protected member function).
π Category π
- Noindexed pages
thatβs the whole page, bestie π«Ά source: cppreference.com; version/date: 2024.06.10; page: std::experi...ol_resource(3). mwah π
π¦ 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