Public Member Functions | List of all members
rmm::mr::detail::arena::block Class Referencefinal

Represents a chunk of memory that can be allocated and deallocated. More...

#include <arena.hpp>

Inheritance diagram for rmm::mr::detail::arena::block:
Inheritance graph
[legend]
Collaboration diagram for rmm::mr::detail::arena::block:
Collaboration graph
[legend]

Public Member Functions

bool fits (std::size_t bytes) const
 Is this block large enough to fit bytes bytes? More...
 
bool is_contiguous_before (block const &blk) const
 Verifies whether this block can be merged to the beginning of block blk. More...
 
std::pair< block, blocksplit (std::size_t bytes) const
 Split this block into two by the given size. More...
 
block merge (block const &blk) const
 Coalesce two contiguous blocks into one. More...
 
 byte_span ()=default
 Construct a default span.
 
 byte_span (void *pointer, std::size_t size)
 Construct a span given a pointer and size. More...
 
- Public Member Functions inherited from rmm::mr::detail::arena::byte_span
 byte_span ()=default
 Construct a default span.
 
 byte_span (void *pointer, std::size_t size)
 Construct a span given a pointer and size. More...
 
char * pointer () const
 Returns the underlying pointer.
 
std::size_t size () const
 Returns the size of the span.
 
char * end () const
 Returns the end of the span.
 
bool is_valid () const
 Returns true if this span is valid (non-null), false otherwise.
 
bool operator< (byte_span const &span) const
 Used by std::set to compare spans.
 

Detailed Description

Represents a chunk of memory that can be allocated and deallocated.

Member Function Documentation

◆ byte_span()

rmm::mr::detail::arena::byte_span::byte_span
inline

Construct a span given a pointer and size.

Parameters
pointerThe address for the beginning of the span.
sizeThe size of the span.

◆ fits()

bool rmm::mr::detail::arena::block::fits ( std::size_t  bytes) const
inline

Is this block large enough to fit bytes bytes?

Parameters
bytesThe size in bytes to check for fit.
Returns
true if this block is at least bytes bytes.

◆ is_contiguous_before()

bool rmm::mr::detail::arena::block::is_contiguous_before ( block const &  blk) const
inline

Verifies whether this block can be merged to the beginning of block blk.

Parameters
blkThe block to check for contiguity.
Returns
true Returns true if this block's pointer + size == blk.pointer.

◆ merge()

block rmm::mr::detail::arena::block::merge ( block const &  blk) const
inline

Coalesce two contiguous blocks into one.

this->is_contiguous_before(blk) must be true.

Parameters
blkblock to merge.
Returns
block The merged block.

◆ split()

std::pair<block, block> rmm::mr::detail::arena::block::split ( std::size_t  bytes) const
inline

Split this block into two by the given size.

Parameters
bytesThe size in bytes of the first block.
Returns
std::pair<block, block> A pair of blocks split by bytes.

The documentation for this class was generated from the following file: