wut v1.8.0
Wii U Toolchain
Loading...
Searching...
No Matches
memallocator.h
Go to the documentation of this file.
1#pragma once
2#include <wut.h>
3#include "memheap.h"
4
13#ifdef __cplusplus
14extern "C" {
15#endif
16
19
20typedef void * (*MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size);
21typedef void (*MEMAllocatorFreeFn) (MEMAllocator *allocator, void *ptr);
22
30 uint32_t align;
31 WUT_UNKNOWN_BYTES(4);
32};
33WUT_CHECK_OFFSET(MEMAllocator, 0x0, funcs);
34WUT_CHECK_OFFSET(MEMAllocator, 0x4, heap);
35WUT_CHECK_OFFSET(MEMAllocator, 0x8, align);
36WUT_CHECK_SIZE(MEMAllocator, 0x10);
37
43WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x0, alloc);
44WUT_CHECK_OFFSET(MEMAllocatorFunctions, 0x4, free);
45WUT_CHECK_SIZE(MEMAllocatorFunctions, 0x8);
46
52void *
54 uint32_t size);
55
61void
63 void *ptr);
64
68void
70 MEMHeapHandle heap,
71 uint32_t alignment);
72
76void
78 MEMHeapHandle heap,
79 uint32_t alignment);
80
84void
86 MEMHeapHandle heap);
87
91void
93
97void
99 MEMHeapHandle heap,
100 uint32_t alignment);
101
102#ifdef __cplusplus
103}
104#endif
105
MEMAllocatorAllocFn alloc
MEMAllocatorFunctions * funcs
Points to the alloc/free functions.
uint32_t align
The alignment the allocator will use.
MEMAllocatorFreeFn free
MEMHeapHandle heap
The heap handle.
void * MEMAllocFromAllocator(MEMAllocator *allocator, uint32_t size)
Allocates memory from the allocator.
void MEMInitAllocatorForUnitHeap(MEMAllocator *allocator, MEMHeapHandle heap)
Initializes an allocator from a Unit Heap.
void MEMInitAllocatorForBlockHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from a Block Heap.
void MEMInitAllocatorForExpHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from an Expanded Heap.
void *(* MEMAllocatorAllocFn)(MEMAllocator *allocator, uint32_t size)
void(* MEMAllocatorFreeFn)(MEMAllocator *allocator, void *ptr)
void MEMFreeToAllocator(MEMAllocator *allocator, void *ptr)
Frees memory back to the allocator.
void MEMInitAllocatorForFrmHeap(MEMAllocator *allocator, MEMHeapHandle heap, uint32_t alignment)
Initializes an allocator from a Frame Heap.
void MEMInitAllocatorForDefaultHeap(MEMAllocator *allocator)
Initializes an allocator from the Default Heap.
Holds context information that will be used to allocate and free memory.
The alloc/free functions.