std::experi...ol_resource(3)

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

πŸ’… std::experi...ol_resource(3) β€” the C++ Standard Library glow-up

okay so bestie, we're in the C++ Standard Library today and this page is literally about std::experimental::pmr::unsynchronized_pool_resource πŸ’– (yes the title gets truncated in the header, that's just the man page being extra, the full name is right there in the NAME section, no cap).


✨ NAME ✨

std::experimental::pmr::unsynchronized_pool_resource β€” like, the same thing again, that's it, that's the name πŸŽ€


🌸 SYNOPSIS 🌸

Defined in header <experimental/memory_resource>:

class unsynchronized_pool_resource : public memory_resource;   (library fundamentals TS)

πŸ¦‹ DESCRIPTION πŸ¦‹

So std::experimental::pmr::unsynchronized_pool_resource is a general-purpose memory resource class, and it's giving very organized-girlie energy. Here's the whole vibe check of what it does πŸ‘‘

  • It owns the memory it allocates and frees it on destruction β€” even if deallocate was never called for some of those allocated blocks. She cleans up after herself, periodt.
  • It's basically a collection of pools, and each pool serves requests for different block sizes. Every pool manages a bunch of chunks, and each chunk gets divided into blocks of uniform size. Very drawer-organizer-core 🧺
  • Calls to do_allocate get dispatched to the pool that serves the smallest blocks that can accommodate the requested size. smallest fit, always.
  • When a pool runs out of memory, the next allocation request for that pool grabs an additional chunk of memory from the upstream allocator to replenish it. And the chunk size it gets grows geometrically β€” she escalates πŸ“ˆ
  • Allocation requests that exceed the largest block size get served from the upstream allocator directly. no middleman.
  • The largest block size and maximum chunk size can be tuned by passing a std::experimental::pmr::pool_options struct to its constructor. customization is self care πŸ’…
⚠️ okay this part is important bestie: unsynchronized_pool_resource is not thread-safe, and it cannot be accessed from multiple threads simultaneously. Use synchronized_pool_resource if you need access from multiple threads. fr fr do not ignore this one 😭

🌈 MEMBER FUNCTIONS 🌈

  • constructor β€” constructs an unsynchronized_pool_resource (public member function)
  • destructor [virtual] β€” destroys an unsynchronized_pool_resource, releasing all allocated memory (virtual public member function)
  • operator= [deleted] β€” the copy assignment operator is deleted; unsynchronized_pool_resource is 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 another memory_resource (virtual protected member function)

πŸŽ€ CATEGORY πŸŽ€

  • Noindexed pages

okay that's the whole page, you ate that bestie ⭐ β€” this was served up fresh from http://cppreference.com, version 2024.06.10, dated the same. mwah πŸ’‹ go allocate something iconic πŸ¦‹πŸ’–

πŸ“¦ where this page comes from