Shortcuts

Class Freelist

Nested Relationships

Class Documentation

class ripple::Freelist

This type is a simple, single-threaded freelist implementation, which is essentially just a singly-linked-list over an arena from which the free list nodes point to.

This can be used in both host and device code, so can quickly allocate dynamically on the device.

Public Functions

Freelist() noexcept

Default constructor.

~Freelist() noexcept

Destructor, resets the head pointer if it’s not a nullptr.

Freelist(const void *start, const void *end, size_t element_size, size_t alignment) noexcept

Constructor to initialize the freelist with the start and end of the arena from which elements can be stored.

Parameters
  • start: The start of the arena.

  • end: The end of the arena.

  • element_size: The size of the elements in the freelist.

  • alignment: The alignment of the elements.

Freelist(Freelist &&other) noexcept = default

Move constructor to move the other freelist to this one.

Parameters
  • other: The other freelist to move.

auto operator=(Freelist &&other) noexcept -> Freelist& = default

Move assignment to move the other freelist to this one.

Parameters
  • other: The other freelist to move.

Freelist(const Freelist&) = delete

Copy constructor deleted since the freelist can’t be copied.

auto operator=(const Freelist&) = delete

Copy assignment deleted since the freelist can’t be copied.

auto pop_front() noexcept -> void*

Pops the most recently added element from the list, and returns a pointer to it.

Return

A pointer to the most recently added element.

auto push_front(void *ptr) noexcept -> void

Pushes a new element onto the front of the list.

Parameters
  • ptr: The pointer to the element to push onto the list.

Docs

Access comprehensive developer documentation for Ripple

View Docs

Tutorials

Get tutorials to help with understand all features

View Tutorials

Examples

Find examples to help get started

View Examples