rlib
Convenience library for useful things
Loading...
Searching...
No Matches

Concrete layout of an RMemAllocator. More...

#include <rlib/rmemallocator.h>

Data Fields

RRef ref
 
const rcharmem_type
 
rsize alignmask
 
RMem *(* alloc )(RMemAllocator *allocator, rsize size, const RMemAllocationParams *params)
 
rboolean(* free )(RMemAllocator *allocator, RMem *mem)
 
rpointer(* map )(RMem *mem, const RMemMapInfo *info)
 
rboolean(* unmap )(RMem *mem, const RMemMapInfo *info)
 
RMem *(* merge )(const RMemAllocationParams *params, RMem **mems, ruint count)
 
RMem *(* copy )(RMem *mem, rssize offset, rssize size)
 
RMem *(* view )(RMem *mem, rssize offset, rssize size)
 

Detailed Description

Concrete layout of an RMemAllocator.

Opaque handle to an allocator backend.

Allocator implementations fill in the mem_type / alignmask fields and the seven vtable slots. Client code treats the struct as opaque and goes through the helpers above.

Field Documentation

◆ alignmask

rsize RMemAllocator::alignmask

Native alignment guarantee of this allocator.

◆ alloc

RMem *(* RMemAllocator::alloc) (RMemAllocator *allocator, rsize size, const RMemAllocationParams *params)

Produce a new chunk.

◆ copy

RMem *(* RMemAllocator::copy) (RMem *mem, rssize offset, rssize size)

Deep-copy a byte range.

◆ free

rboolean(* RMemAllocator::free) (RMemAllocator *allocator, RMem *mem)

Release a chunk's backing storage.

◆ map

rpointer(* RMemAllocator::map) (RMem *mem, const RMemMapInfo *info)

Acquire a data pointer for r_mem_map.

◆ mem_type

const rchar* RMemAllocator::mem_type

Registry name (e.g. R_MEM_ALLOCATOR_SYSTEM).

◆ merge

RMem *(* RMemAllocator::merge) (const RMemAllocationParams *params, RMem **mems, ruint count)

Concatenate mems into a fresh chunk.

◆ ref

RRef RMemAllocator::ref

Refcount base.

◆ unmap

rboolean(* RMemAllocator::unmap) (RMem *mem, const RMemMapInfo *info)

Release the data pointer for r_mem_unmap.

◆ view

RMem *(* RMemAllocator::view) (RMem *mem, rssize offset, rssize size)

Create an aliased view.


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