Public Member Functions | List of all members
rmm::mr::detail::coalescing_free_list Struct Reference

An ordered list of free memory blocks that coalesces contiguous blocks on insertion. More...

#include <coalescing_free_list.hpp>

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

Public Member Functions

void insert (block_type const &b)
 Inserts a block into the free_list in the correct order, coalescing it with the preceding and following blocks if either is contiguous. More...
 
void insert (free_list &&other)
 Moves blocks from range [first, last) into the free_list in their correct order, coalescing them with their preceding and following blocks if they are contiguous. More...
 
block_type get_block (size_t size)
 Finds the smallest block in the free_list large enough to fit size bytes. More...
 
void print () const
 Print all blocks in the free_list.
 
- Public Member Functions inherited from rmm::mr::detail::free_list< block >
iterator begin () noexcept
 
const_iterator begin () const noexcept
 beginning of the free list
 
const_iterator cbegin () const noexcept
 beginning of the free list
 
iterator end () noexcept
 beginning of the free list
 
const_iterator end () const noexcept
 end of the free list
 
const_iterator cend () const noexcept
 end of the free list
 
size_type size () const noexcept
 end of the free list More...
 
bool is_empty () const noexcept
 checks whether the free_list is empty. More...
 
void erase (const_iterator iter)
 Removes the block indicated by iter from the free list. More...
 
void clear () noexcept
 Erase all blocks from the free_list.
 
void print () const
 Print all blocks in the free_list.
 

Additional Inherited Members

- Public Types inherited from rmm::mr::detail::free_list< block >
using block_type = block
 
using list_type = std::list< block >
 
using size_type = typename list_type::size_type
 
using iterator = typename list_type::iterator
 
using const_iterator = typename list_type::const_iterator
 
- Protected Member Functions inherited from rmm::mr::detail::free_list< block >
void insert (const_iterator pos, block_type const &b)
 Insert a block in the free list before the specified position. More...
 
void splice (const_iterator pos, free_list &&other)
 Inserts a list of blocks in the free list before the specified position. More...
 
void push_back (const block_type &b)
 Appends the given block to the end of the free list. More...
 
void push_back (block_type &&b)
 Appends the given block to the end of the free list. b is moved to the new element. More...
 
void pop_front ()
 Removes the first element of the free list. If there are no elements in the free list, the behavior is undefined. More...
 

Detailed Description

An ordered list of free memory blocks that coalesces contiguous blocks on insertion.

Template Parameters
list_typethe type of the internal list data structure.

Member Function Documentation

◆ get_block()

block_type rmm::mr::detail::coalescing_free_list::get_block ( size_t  size)
inline

Finds the smallest block in the free_list large enough to fit size bytes.

This is a "best fit" search.

Parameters
sizeThe size in bytes of the desired block.
Returns
block A block large enough to store size bytes.

◆ insert() [1/2]

void rmm::mr::detail::coalescing_free_list::insert ( block_type const &  b)
inline

Inserts a block into the free_list in the correct order, coalescing it with the preceding and following blocks if either is contiguous.

Parameters
bThe block to insert.

◆ insert() [2/2]

void rmm::mr::detail::coalescing_free_list::insert ( free_list &&  other)
inline

Moves blocks from range [first, last) into the free_list in their correct order, coalescing them with their preceding and following blocks if they are contiguous.

Template Parameters
InputItiterator type
Parameters
firstThe beginning of the range of blocks to insert
lastThe end of the range of blocks to insert.

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