xrpld
Loading...
Searching...
No Matches
xrpl::SlabAllocator< Type >::SlabBlock Struct Reference

A block of memory that is owned by a slab allocator. More...

Collaboration diagram for xrpl::SlabAllocator< Type >::SlabBlock:

Public Member Functions

 SlabBlock (SlabBlock *next, std::uint8_t *data, std::size_t size, std::size_t item)
 ~SlabBlock ()=default
 SlabBlock (SlabBlock const &other)=delete
SlabBlockoperator= (SlabBlock const &other)=delete
 SlabBlock (SlabBlock &&other)=delete
SlabBlockoperator= (SlabBlock &&other)=delete
bool own (std::uint8_t const *pIn) const noexcept
 Determines whether the given pointer belongs to this allocator.
std::uint8_tallocate () noexcept
void deallocate (std::uint8_t *ptr) noexcept
 Return an item to this allocator's freelist.

Public Attributes

std::mutex m
std::uint8_tl = nullptr
SlabBlocknext
std::uint8_t const *const p = nullptr
std::size_t const size

Detailed Description

template<typename Type>
struct xrpl::SlabAllocator< Type >::SlabBlock

A block of memory that is owned by a slab allocator.

Definition at line 36 of file SlabAllocator.h.

Constructor & Destructor Documentation

◆ SlabBlock() [1/3]

template<typename Type>
xrpl::SlabAllocator< Type >::SlabBlock::SlabBlock ( SlabBlock * next,
std::uint8_t * data,
std::size_t size,
std::size_t item )

Definition at line 53 of file SlabAllocator.h.

◆ ~SlabBlock()

template<typename Type>
xrpl::SlabAllocator< Type >::SlabBlock::~SlabBlock ( )
default

◆ SlabBlock() [2/3]

template<typename Type>
xrpl::SlabAllocator< Type >::SlabBlock::SlabBlock ( SlabBlock const & other)
delete

◆ SlabBlock() [3/3]

template<typename Type>
xrpl::SlabAllocator< Type >::SlabBlock::SlabBlock ( SlabBlock && other)
delete

Member Function Documentation

◆ operator=() [1/2]

template<typename Type>
SlabBlock & xrpl::SlabAllocator< Type >::SlabBlock::operator= ( SlabBlock const & other)
delete

◆ operator=() [2/2]

template<typename Type>
SlabBlock & xrpl::SlabAllocator< Type >::SlabBlock::operator= ( SlabBlock && other)
delete

◆ own()

template<typename Type>
bool xrpl::SlabAllocator< Type >::SlabBlock::own ( std::uint8_t const * pIn) const
noexcept

Determines whether the given pointer belongs to this allocator.

Definition at line 84 of file SlabAllocator.h.

◆ allocate()

template<typename Type>
std::uint8_t * xrpl::SlabAllocator< Type >::SlabBlock::allocate ( )
noexcept

Definition at line 90 of file SlabAllocator.h.

◆ deallocate()

template<typename Type>
void xrpl::SlabAllocator< Type >::SlabBlock::deallocate ( std::uint8_t * ptr)
noexcept

Return an item to this allocator's freelist.

Parameters
ptrThe pointer to the chunk of memory being deallocated.
Note
This is a dangerous, private interface; the item being returned should belong to this allocator. Debug builds will check and assert if this is not the case. Release builds will not.

Definition at line 119 of file SlabAllocator.h.

Member Data Documentation

◆ m

template<typename Type>
std::mutex xrpl::SlabAllocator< Type >::SlabBlock::m

Definition at line 39 of file SlabAllocator.h.

◆ l

template<typename Type>
std::uint8_t* xrpl::SlabAllocator< Type >::SlabBlock::l = nullptr

Definition at line 42 of file SlabAllocator.h.

◆ next

template<typename Type>
SlabBlock* xrpl::SlabAllocator< Type >::SlabBlock::next

Definition at line 45 of file SlabAllocator.h.

◆ p

template<typename Type>
std::uint8_t const* const xrpl::SlabAllocator< Type >::SlabBlock::p = nullptr

Definition at line 48 of file SlabAllocator.h.

◆ size

template<typename Type>
std::size_t const xrpl::SlabAllocator< Type >::SlabBlock::size

Definition at line 51 of file SlabAllocator.h.