rippled
|
Classes | |
struct | SlabBlock |
A block of memory that is owned by a slab allocator. More... | |
Public Member Functions | |
constexpr | SlabAllocator (std::size_t extra, std::size_t alloc=0, std::size_t align=0) |
Constructs a slab allocator able to allocate objects of a fixed size. More... | |
SlabAllocator (SlabAllocator const &other)=delete | |
SlabAllocator & | operator= (SlabAllocator const &other)=delete |
SlabAllocator (SlabAllocator &&other)=delete | |
SlabAllocator & | operator= (SlabAllocator &&other)=delete |
~SlabAllocator () | |
constexpr std::size_t | size () const noexcept |
Returns the size of the memory block this allocator returns. More... | |
std::uint8_t * | allocate () noexcept |
Returns a suitably aligned pointer, if one is available. More... | |
bool | deallocate (std::uint8_t *ptr) noexcept |
Returns the memory block to the allocator. More... | |
Private Attributes | |
std::atomic< SlabBlock * > | slabs_ = nullptr |
const std::size_t | itemAlignment_ |
const std::size_t | itemSize_ |
const std::size_t | slabSize_ |
Definition at line 43 of file SlabAllocator.h.
|
explicitconstexpr |
Constructs a slab allocator able to allocate objects of a fixed size.
count | the number of items the slab allocator can allocate; note that a count of 0 is valid and means that the allocator is, effectively, disabled. This can be very useful in some contexts (e.g. when mimimal memory usage is needed) and allows for graceful failure. |
Definition at line 178 of file SlabAllocator.h.
|
delete |
|
delete |
ripple::SlabAllocator< Type >::~SlabAllocator | ( | ) |
Definition at line 198 of file SlabAllocator.h.
|
delete |
|
delete |
|
constexprnoexcept |
Returns the size of the memory block this allocator returns.
Definition at line 207 of file SlabAllocator.h.
|
noexcept |
Returns a suitably aligned pointer, if one is available.
Definition at line 218 of file SlabAllocator.h.
|
noexcept |
Returns the memory block to the allocator.
ptr | A pointer to a memory block. |
size | If non-zero, a hint as to the size of the block. |
Definition at line 295 of file SlabAllocator.h.
|
private |
Definition at line 157 of file SlabAllocator.h.
|
private |
Definition at line 160 of file SlabAllocator.h.
|
private |
Definition at line 164 of file SlabAllocator.h.
|
private |
Definition at line 167 of file SlabAllocator.h.