template<int ChunkSize>
class nda::mem::multi_bucket< ChunkSize >
Custom allocator that uses multiple nda::mem::bucket allocators.
It uses a std::vector of bucket allocators. When all buckets in the vector are full, it simply adds a new one at the end.
- Note
- Only works with Host nda::mem::AddressSpace.
- Template Parameters
-
| ChunkSize | Size of the chunks in bytes. |
Definition at line 264 of file allocators.hpp.
|
|
| multi_bucket () |
| | Default constructor.
|
|
| multi_bucket (multi_bucket &&)=default |
| | Default move constructor.
|
|
| multi_bucket (multi_bucket const &)=delete |
| | Deleted copy constructor.
|
| blk_t | allocate (size_t s) noexcept |
| | Allocate a chunk of memory in the current bucket or find a new one if the current one is full.
|
| blk_t | allocate_zero (size_t s) noexcept |
| | Allocate a chunk of memory in the current bucket or find a new one if the current one is full and set it to zero.
|
| auto const & | buckets () const noexcept |
| | Get the bucket vector.
|
| void | deallocate (blk_t b) noexcept |
| | Deallocate a chunk of memory from the bucket to which it belongs.
|
| bool | empty () const noexcept |
| | Check if the current allocator is empty.
|
|
multi_bucket & | operator= (multi_bucket &&)=default |
| | Default move assignment operator.
|
|
multi_bucket & | operator= (multi_bucket const &)=delete |
| | Deleted copy assignment operator.
|
| bool | owns (blk_t b) const noexcept |
| | Check if a given nda::mem::blk_t memory block is owned by allocator.
|