A memory resource which allocates memory blocks of a single fixed size. More...
#include <fixed_size_memory_resource.hpp>


Public Member Functions | |
| fixed_size_memory_resource (cuda::mr::any_resource< cuda::mr::device_accessible > upstream, std::size_t block_size=default_block_size, std::size_t blocks_to_preallocate=default_blocks_to_preallocate) | |
Construct a new fixed_size_memory_resource that allocates memory from upstream. More... | |
| device_async_resource_ref | get_upstream_resource () const noexcept |
| device_async_resource_ref to the upstream resource More... | |
| std::size_t | get_block_size () const noexcept |
| Get the size of blocks allocated by this memory resource. More... | |
Static Public Attributes | |
| static constexpr std::size_t | default_block_size = 1 << 20 |
| Default allocation block size. | |
| static constexpr std::size_t | default_blocks_to_preallocate = 128 |
Friends | |
| void | get_property (fixed_size_memory_resource const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::device_accessible property. More... | |
A memory resource which allocates memory blocks of a single fixed size.
Supports only allocations of size smaller than the configured block_size.
This class is copyable and shares ownership of its internal state, allowing multiple instances to safely reference the same underlying pool.
|
explicit |
Construct a new fixed_size_memory_resource that allocates memory from upstream.
When the pool of blocks is all allocated, grows the pool by allocating blocks_to_preallocate more blocks from upstream.
| upstream | The resource from which to allocate blocks for the pool. |
| block_size | The size of blocks to allocate. |
| blocks_to_preallocate | The number of blocks to allocate to initialize the pool. |
|
noexcept |
Get the size of blocks allocated by this memory resource.
|
noexcept |
device_async_resource_ref to the upstream resource
|
friend |
Enables the cuda::mr::device_accessible property.
This property declares that a fixed_size_memory_resource provides device accessible memory
|
staticconstexpr |
The number of blocks that the pool starts out with, and also the number of blocks by which the pool grows when all of its current blocks are allocated