wavelength 1.0.0
Loading...
Searching...
No Matches
PoolAllocator Class Reference

A fixed-size allocator over one block of IOP memory. More...

#include <poolallocator.h>

Public Member Functions

void InitWithBlock (int elementSize, int count, void *block)
 Carve a caller-supplied block into elements.
void Init (int elementSize, int count)
 Allocate a block and carve it into elements, rounding the element size up to a word.
void Release ()
 Release the block Init() allocated.
void * Alloc ()
 Take an element off the free list.
void Free (void *element)
 Return an element to the free list.

Detailed Description

A fixed-size allocator over one block of IOP memory.

The class has no RTTI, and its name is inferred from its role. Free elements form a singly linked list through their first word. Elements are raw storage, and no constructor runs on them.

Member Function Documentation

◆ InitWithBlock()

void PoolAllocator::InitWithBlock ( int elementSize,
int count,
void * block )

Carve a caller-supplied block into elements.

Parameters
elementSizeBytes per element, at least the size of a pointer.
countNumber of elements.
blockThe block, at least elementSize times count bytes.
Ghidra address:
NTSC-U/C: 0x000013a0
Ghidra address:
PAL: 0x000013a0

◆ Init()

void PoolAllocator::Init ( int elementSize,
int count )

Allocate a block and carve it into elements, rounding the element size up to a word.

Parameters
elementSizeBytes per element.
countNumber of elements.
Ghidra address:
NTSC-U/C: 0x000013c0
Ghidra address:
PAL: 0x000013c0

◆ Release()

void PoolAllocator::Release ( )

Release the block Init() allocated.

Ghidra address:
NTSC-U/C: 0x00001480
Ghidra address:
PAL: 0x00001480

◆ Alloc()

void * PoolAllocator::Alloc ( )

Take an element off the free list.

Returns
Raw storage for one element, or null when every element is in use.
Ghidra address:
NTSC-U/C: 0x000014a4
Ghidra address:
PAL: 0x000014a4

◆ Free()

void PoolAllocator::Free ( void * element)

Return an element to the free list.

Parameters
elementStorage Alloc() returned.
Ghidra address:
NTSC-U/C: 0x000014d0
Ghidra address:
PAL: 0x000014d0

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