WPILibC++ 2025.1.1
|
This class implements a pool memory resource. More...
Public Member Functions | |
PoolResource (size_t blocksPerChunk) | |
Constructs a default PoolResource. | |
PoolResource (const PoolResource &)=delete | |
PoolResource & | operator= (const PoolResource &)=delete |
PoolResource (PoolResource &&)=default | |
PoolResource & | operator= (PoolResource &&)=default |
void * | allocate (size_t bytes, size_t alignment=alignof(std::max_align_t)) |
Returns a block of memory from the pool. | |
void | deallocate (void *p, size_t bytes, size_t alignment=alignof(std::max_align_t)) |
Gives a block of memory back to the pool. | |
bool | is_equal (const PoolResource &other) const noexcept |
Returns true if this pool resource has the same backing storage as another. | |
size_t | blocks_in_use () const noexcept |
Returns the number of blocks from this pool resource that are in use. | |
This class implements a pool memory resource.
The pool allocates chunks of memory and splits them into blocks managed by a free list. Allocations return pointers from the free list, and deallocations return pointers to the free list.
|
inlineexplicit |
Constructs a default PoolResource.
blocksPerChunk | Number of blocks per chunk of memory. |
|
delete |
|
default |
|
inlinenodiscard |
Returns a block of memory from the pool.
bytes | Number of bytes in the block. |
alignment | Alignment of the block (unused). |
|
inlinenoexcept |
Returns the number of blocks from this pool resource that are in use.
|
inline |
Gives a block of memory back to the pool.
p | A pointer to the block of memory. |
bytes | Number of bytes in the block (unused). |
alignment | Alignment of the block (unused). |
|
inlinenoexcept |
Returns true if this pool resource has the same backing storage as another.
|
delete |
|
default |