Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::pmr::synchronized_pool_resource

      From cppreference.com
      <cpp‎ |memory
       
       
      Memory management library
      (exposition only*)
      Allocators
      Uninitialized memory algorithms
      Constrained uninitialized memory algorithms
      Memory resources
      pmr::synchronized_pool_resource
      (C++17)

      Uninitialized storage(until C++20)
      (until C++20*)
      (until C++20*)
      Garbage collector support(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
      (C++11)(until C++23)
       
       
      Defined in header<memory_resource>
      class synchronized_pool_resource:publicstd::pmr::memory_resource;
      (since C++17)

      The classstd::pmr::synchronized_pool_resource is a general-purpose memory resource class with the following properties:

      • It owns the allocated memory and frees it on destruction, even ifdeallocate has not been called for some of the allocated blocks.
      • It consists of a collection ofpools that serves requests for different block sizes. Each pool manages a collection ofchunks that are then divided into blocks of uniform size.
      • Calls todo_allocate are 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 theupstream allocator to replenish the pool. The chunk size obtained increases geometrically.
      • Allocations requests that exceed the largest block size are served from theupstream allocator directly.
      • The largest block size and maximum chunk size may be tuned by passing astd::pmr::pool_options struct to its constructor.

      synchronized_pool_resource 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.

      [edit]Member functions

      constructs asynchronized_pool_resource
      (public member function)[edit]
      [virtual]
      destroys asynchronized_pool_resource, releasing all allocated memory
      (virtual public member function)[edit]
      operator=
      [deleted]
      copy assignment operator is deleted.synchronized_pool_resource is not copy assignable
      (public member function)[edit]
      Public member functions
      release all allocated memory
      (public member function)[edit]
      returns a pointer to the upstream memory resource
      (public member function)[edit]
      returns the options that control the pooling behavior of this resource
      (public member function)[edit]
      Protected member functions
      [virtual]
      allocate memory
      (virtual protected member function)[edit]
      [virtual]
      return memory to the pool
      (virtual protected member function)[edit]
      [virtual]
      compare for equality with anothermemory_resource
      (virtual protected member function)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/memory/synchronized_pool_resource&oldid=166135"

      [8]ページ先頭

      ©2009-2025 Movatter.jp