cbase 1.46.11
C/C++ Static Template
Loading...
Searching...
No Matches
Allocator Struct Reference

A generic allocator backed by function pointers (vtable). More...

#include <mem_allocator.h>

Public Attributes

void * ctx
AllocFn alloc
FreeFn free
ReallocFn realloc

Detailed Description

A generic allocator backed by function pointers (vtable).

Pass by pointer to any function that needs to allocate memory without caring about the concrete allocator type.

Note
Passing by pointer is preferred over by value to allow the callee to observe state changes (e.g., arena pos advancing).

Definition at line 108 of file mem_allocator.h.

Member Data Documentation

◆ alloc

AllocFn Allocator::alloc

Allocation function. Must not be NULL.

Definition at line 110 of file mem_allocator.h.

◆ ctx

void* Allocator::ctx

Opaque context passed to every function pointer.

Definition at line 109 of file mem_allocator.h.

◆ free

FreeFn Allocator::free

Free function. May be NULL for arena allocators.

Definition at line 111 of file mem_allocator.h.

◆ realloc

ReallocFn Allocator::realloc

Realloc function. May be NULL if not supported.

Definition at line 112 of file mem_allocator.h.


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