![]() |
Super Mario 64 Source
A Super Mario 64 decompilation, brought to you by a bunch of clever folks.
|
This file contains the functions need to manage allocation in goddard's heap. More...
Functions | |
void | empty_mem_block (struct GMemBlock *block) |
Empty a GMemBlock into a default state. More... | |
struct GMemBlock * | into_free_memblock (struct GMemBlock *block) |
Transform a GMemBlock into a free block that points to memory available for allocation. More... | |
struct GMemBlock * | make_mem_block (u32 blockType, u8 permFlag) |
Allocate a new GMemBlock structure of the given type and permanence. More... | |
u32 | print_list_stats (struct GMemBlock *block, s32 printBlockInfo, s32 permanence) |
Print information (size, entries) about the GMemBlock list. More... | |
u32 | gd_free_mem (void *ptr) |
Free memory allocated on the goddard heap. More... | |
void * | gd_request_mem (u32 size, u8 permanence) |
Request a pointer to goddard heap memory of at least size and of the same permanence . More... | |
struct GMemBlock * | gd_add_mem_to_heap (u32 size, u32 addr, u8 permanence) |
Add memory of size at addr to the goddard heap for later allocation. More... | |
void | init_mem_block_lists (void) |
NULL the various GMemBlock list heads. More... | |
void | mem_stats (void) |
Print summary information about all used, free, and empty GMemBlock s. More... | |
Variables | |
static struct GMemBlock * | sFreeBlockListHead |
static struct GMemBlock * | sUsedBlockListHead |
static struct GMemBlock * | sEmptyBlockListHead |
This file contains the functions need to manage allocation in goddard's heap.
However, the actual, useable allocation functions are gd_malloc()
, gd_malloc_perm()
, and gd_malloc_temp()
, as well as gd_free()
. This file is for managing the underlying memory block lists.
Empty a GMemBlock
into a default state.
This empty block doesn't point to any data, nor does it have any size. The block is removed from whatever list is was in, and is added to the empty block list.
Add memory of size
at addr
to the goddard heap for later allocation.
GMemBlock
that contains info about the new heap memory Free memory allocated on the goddard heap.
ptr | pointer to heap allocated memory |
0 | ptr did not point to a valid memory block |
Request a pointer to goddard heap memory of at least size
and of the same permanence
.
NULL | could not fulfill the request |
Allocate a new GMemBlock
structure of the given type and permanence.
It does not assign any heap space to the new block.
blockType | either G_MEM_BLOCK_FREE or G_MEM_BLOCK_USED |
permFlag | some sort of permanence value, where setting one the upper four bits imply a permanent block, while setting one the lower four bits imply a temporary block |
GMemBlock
Print information (size, entries) about the GMemBlock
list.
It can print information for individual blocks as well as summary info for the entry list.
block | GMemBlock to start reading the list |
printBlockInfo | If TRUE , print information about every block in the list |
permanence | Limit info printed to blocks with this permanence |