std::pmr::s...:do_allocate(3)

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

🌸 NAME 🌸

okay so this is the std::pmr::synchronized_pool_resource::do_allocate page from the C++ Standard Libary manual β€” yes, that’s the manual name and we’re keeping it exactly as-is, bestie πŸ’– (the page title is std::pmr::s...:do_allocate(3) if you were wondering).

std::pmr::synchronized_pool_resource::do_allocate β€” that’s the function we’re obsessing over.


✨ Synopsis ✨

virtual void* do_allocate( std::size_t bytes, std::size_t alignment );

(since C++17)

It allocates storage. That’s the whole main-character job, no cap.

If the pool selected for a block of size bytes can’t satisfy the request from its internal data structures, it calls allocate() on the upstream memory resource to obtain memory. like, it goes shopping upstream πŸ›οΈ

If the size requested is larger than what the largest pool can handle, memory is allocated by calling allocate() on the upstream memory resource. so basically: too big for the biggest pool? upstream gets the call.


πŸŽ€ Return value πŸŽ€

A pointer to allocated storage of at least bytes bytes in size, aligned to the specified alignment if such alignment is supported, and to alignof(std::max_align_t) otherwise. ✨


πŸ’€ Exceptions πŸ’€

Throws nothing unless calling allocate() on the upstream memory resource throws. simple as that, bestie.

πŸ‘€ See also πŸ‘€

  • allocate β€” allocates memory (public member function of std::pmr::memory_resource)
  • do_allocate β€” allocates memory [virtual] (virtual private member function of std::pmr::memory_resource)

that’s the tea πŸ“ β€” source: http://cppreference.com ✨ version/date: 2024.06.10 ✨ page: std::pmr::s...:do_allocate(3) πŸ’…

πŸ“¦ where this page comes from