Muteki
EABI code execution on Besta® RTOS devices.
Loading...
Searching...
No Matches
arena.h File Reference

UI arena allocator functions. More...

Go to the source code of this file.

Functions

ui_component_t * AllocBlock (size_t size, unsigned short tag, bool new_segment)
 Allocate memory on the secondary heap.
void FreeBlock (ui_component_t *ptr)
 Free memory previously allocated with AllocBlock().

Detailed Description

UI arena allocator functions.

Allocate/deallocate UI components using the UI arena allocator.

Function Documentation

◆ AllocBlock()

ui_component_t * AllocBlock ( size_t size,
unsigned short tag,
bool new_segment )
extern

Allocate memory on the secondary heap.

This allocates a block of memory on the UI memory arena, that is backed by a large block of memory on the system heap. This arena is usually 64KiB in size.

Warning
Memory allocated with this function has to be freed with the FreeBlock() call.
Syscall Number
0x10145
Parameters
sizeSize of the memory.
tagWrite this value to <allocated address> + 0x28 (<chunk address> + 0x30) when the allocated memory is located on a fresh chunk (i.e. allocated on previously unused memory directly following the last chunk).
new_segmentSet to true to start a new segment. This will prevent this chunk and all chunks above from being reused until this memory is freed.
Returns
The allocated memory.

◆ FreeBlock()

void FreeBlock ( ui_component_t * ptr)
extern

Free memory previously allocated with AllocBlock().

If a segment chunk is freed, everything below it will also be implicitly freed.

Syscall Number
0x10146
Parameters
ptrPointer to previously allocated memory.
Returns
None.