Skip to content

memory


memory_statistics class (details::memory_statistics)

memory_statistics

mem_header class (details::mem_header)

mem_header

aligned_allocate function

template <typename T = void,
          size_t alignment = default_memory_alignment>
T *aligned_allocate(size_t size = 1)

Allocates aligned memory


template <typename T = void>
T *aligned_allocate(size_t size, size_t alignment)

Allocates aligned memory


aligned_deallocate function

template <typename T = void> void aligned_deallocate(T *ptr)

Deallocates aligned memory


aligned_deleter class (details::aligned_deleter)

template <typename T> aligned_deleter

autofree class

template <typename T> autofree

Smart pointer for aligned memory with automatic deallocation.

autofree<T> function (autofree::autofree<T>)

autofree()

Default constructor.

explicit autofree(size_t size)
    : ptr(aligned_allocate<T>(size))

Allocates aligned memory for given size.

operator[] function (autofree::operator[])

T &operator[](size_t index) noexcept

Access element at index.

const T &operator[](size_t index) const noexcept

Const access to element at index.

data function (autofree::data)

template <typename U = T> U *data() noexcept

Returns pointer to underlying data.

template <typename U = T> const U *data() const noexcept

Returns const pointer to underlying data.

ptr variable (autofree::ptr)

std::unique_ptr<T[], details::aligned_deleter<T>> ptr

Unique pointer with custom deleter for aligned memory.


data_allocator class

template <typename T> data_allocator

Aligned allocator

rebind class (data_allocator::rebind)

template <typename U> rebind

aligned_new class

aligned_new

call_with_temp function

template <size_t stack_size = 4096, typename T = u8,
          typename Fn>
static void call_with_temp(size_t temp_size, Fn &&fn)

Calls a function with a temporary buffer, allocated on the stack if small enough, otherwise on the heap.
Template param stack_size Maximum size to use stack allocation (in elements).
Template param T Type of temporary buffer elements (default: u8).
Template param Fn Callable type.
Param temp_size Number of elements requested.
Param fn Function to call with a pointer to the buffer.


Auto-generated from sources, Revision , https://github.com/kfrlib/kfr/blob//include/kfr/