libcute 0.1
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
allocator.h File Reference
#include <stddef.h>
#include "io/error.h"
#include "nostd.h"
#include "utility.h"
Include dependency graph for allocator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  cu_Allocator
 

Typedefs

typedef cu_IoSlice_Result(* cu_Allocator_AllocFunc) (void *self, cu_Layout layout)
 
typedef cu_IoSlice_Result(* cu_Allocator_GrowFunc) (void *self, cu_Slice old_mem, cu_Layout new_layout)
 
typedef cu_IoSlice_Result(* cu_Allocator_ShrinkFunc) (void *self, cu_Slice old_mem, cu_Layout new_layout)
 
typedef void(* cu_Allocator_FreeFunc) (void *self, cu_Slice mem)
 

Functions

cu_Allocator cu_Allocator_CAllocator (void)
 
cu_Allocator cu_Allocator_NullAllocator (void)
 

Detailed Description

Generic allocator interface.

Typedef Documentation

◆ cu_Allocator_AllocFunc

typedef cu_IoSlice_Result(* cu_Allocator_AllocFunc) (void *self, cu_Layout layout)

Allocation function signature.

◆ cu_Allocator_FreeFunc

typedef void(* cu_Allocator_FreeFunc) (void *self, cu_Slice mem)

Free function signature.

◆ cu_Allocator_GrowFunc

typedef cu_IoSlice_Result(* cu_Allocator_GrowFunc) (void *self, cu_Slice old_mem, cu_Layout new_layout)

Grow function signature.

◆ cu_Allocator_ShrinkFunc

typedef cu_IoSlice_Result(* cu_Allocator_ShrinkFunc) (void *self, cu_Slice old_mem, cu_Layout new_layout)

Shrink function signature.

Function Documentation

◆ cu_Allocator_CAllocator()

cu_Allocator cu_Allocator_CAllocator ( void  )

System allocator backed by libc malloc/free.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cu_Allocator_NullAllocator()

cu_Allocator cu_Allocator_NullAllocator ( void  )

Allocator that always fails with out-of-memory errors.

Here is the call graph for this function:
Here is the caller graph for this function: