libctru v2.5.0
Loading...
Searching...
No Matches
Functions
linear.h File Reference

Linear memory allocator. More...

#include <stddef.h>

Go to the source code of this file.

Functions

void * linearAlloc (size_t size)
 Allocates a 0x80-byte aligned buffer.
 
void * linearMemAlign (size_t size, size_t alignment)
 Allocates a buffer aligned to the given size.
 
void * linearRealloc (void *mem, size_t size)
 Reallocates a buffer.
 
size_t linearGetSize (void *mem)
 Retrieves the allocated size of a buffer.
 
void linearFree (void *mem)
 Frees a buffer.
 
u32 linearSpaceFree (void)
 Gets the current linear free space.
 

Detailed Description

Linear memory allocator.

Function Documentation

◆ linearAlloc()

void * linearAlloc ( size_t  size)

◆ linearFree()

void linearFree ( void *  mem)

◆ linearGetSize()

size_t linearGetSize ( void *  mem)

Retrieves the allocated size of a buffer.

Returns
The size of the buffer.

◆ linearMemAlign()

void * linearMemAlign ( size_t  size,
size_t  alignment 
)

Allocates a buffer aligned to the given size.

Parameters
sizeSize of the buffer to allocate.
alignmentAlignment to use.
Returns
The allocated buffer.
Examples
mvd/source/main.c.

◆ linearRealloc()

void * linearRealloc ( void *  mem,
size_t  size 
)

Reallocates a buffer.

Note: Not implemented yet.

Parameters
memBuffer to reallocate.
sizeSize of the buffer to allocate.
Returns
The reallocated buffer.

◆ linearSpaceFree()

u32 linearSpaceFree ( void  )

Gets the current linear free space.

Returns
The current linear free space.