wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
Data Structures | Typedefs | Functions
Allocator

Functions for managing generic allocator objects. More...

Collaboration diagram for Allocator:

Data Structures

struct  MEMAllocator
 Holds context information that will be used to allocate and free memory. More...
 
struct  MEMAllocatorFunctions
 The alloc/free functions. More...
 

Typedefs

typedef struct MEMAllocatorFunctions MEMAllocatorFunctions
 
typedef struct MEMAllocator MEMAllocator
 
typedef void *(* MEMAllocatorAllocFn) (MEMAllocator *allocator, uint32_t size)
 
typedef void(* MEMAllocatorFreeFn) (MEMAllocator *allocator, void *ptr)
 

Functions

void * MEMAllocFromAllocator (MEMAllocator *allocator, uint32_t size)
 Allocates memory from the allocator.
 
void MEMFreeToAllocator (MEMAllocator *allocator, void *ptr)
 Frees memory back to the allocator.
 
void MEMInitAllocatorForExpHeap (MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
 Initializes an allocator from an Expanded Heap.
 
void MEMInitAllocatorForFrmHeap (MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
 Initializes an allocator from a Frame Heap.
 
void MEMInitAllocatorForUnitHeap (MEMAllocator *allocator, MEMHeapHandle heap)
 Initializes an allocator from a Unit Heap.
 
void MEMInitAllocatorForDefaultHeap (MEMAllocator *allocator)
 Initializes an allocator from the Default Heap.
 
void MEMInitAllocatorForBlockHeap (MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
 Initializes an allocator from a Block Heap.
 

Detailed Description

Functions for managing generic allocator objects.


Data Structure Documentation

◆ MEMAllocator

struct MEMAllocator

Holds context information that will be used to allocate and free memory.

Definition at line 24 of file memallocator.h.

Data Fields
MEMAllocatorFunctions * funcs Points to the alloc/free functions.
MEMHeapHandle heap The heap handle.
uint32_t align The alignment the allocator will use.

◆ MEMAllocatorFunctions

struct MEMAllocatorFunctions

The alloc/free functions.

Definition at line 39 of file memallocator.h.

Data Fields
MEMAllocatorAllocFn alloc
MEMAllocatorFreeFn free

Typedef Documentation

◆ MEMAllocatorFunctions

Definition at line 17 of file memallocator.h.

◆ MEMAllocator

typedef struct MEMAllocator MEMAllocator

Definition at line 18 of file memallocator.h.

◆ MEMAllocatorAllocFn

typedef void *(* MEMAllocatorAllocFn) (MEMAllocator *allocator, uint32_t size)

Definition at line 20 of file memallocator.h.

◆ MEMAllocatorFreeFn

typedef void(* MEMAllocatorFreeFn) (MEMAllocator *allocator, void *ptr)

Definition at line 21 of file memallocator.h.

Function Documentation

◆ MEMAllocFromAllocator()

void * MEMAllocFromAllocator ( MEMAllocator allocator,
uint32_t  size 
)

Allocates memory from the allocator.

Returns
allocator->funcs.alloc(allocator, size).

◆ MEMFreeToAllocator()

void MEMFreeToAllocator ( MEMAllocator allocator,
void *  ptr 
)

Frees memory back to the allocator.

It simply calls allocator->funcs.free(allocator, ptr).

◆ MEMInitAllocatorForExpHeap()

void MEMInitAllocatorForExpHeap ( MEMAllocator allocator,
MEMHeapHandle  heap,
uint32_t  alignment 
)

Initializes an allocator from an Expanded Heap.

◆ MEMInitAllocatorForFrmHeap()

void MEMInitAllocatorForFrmHeap ( MEMAllocator allocator,
MEMHeapHandle  heap,
uint32_t  alignment 
)

Initializes an allocator from a Frame Heap.

◆ MEMInitAllocatorForUnitHeap()

void MEMInitAllocatorForUnitHeap ( MEMAllocator allocator,
MEMHeapHandle  heap 
)

Initializes an allocator from a Unit Heap.

◆ MEMInitAllocatorForDefaultHeap()

void MEMInitAllocatorForDefaultHeap ( MEMAllocator allocator)

Initializes an allocator from the Default Heap.

◆ MEMInitAllocatorForBlockHeap()

void MEMInitAllocatorForBlockHeap ( MEMAllocator allocator,
MEMHeapHandle  heap,
uint32_t  alignment 
)

Initializes an allocator from a Block Heap.