libctru  v2.4.1
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. More...
 
void * linearMemAlign (size_t size, size_t alignment)
 Allocates a buffer aligned to the given size. More...
 
void * linearRealloc (void *mem, size_t size)
 Reallocates a buffer. More...
 
size_t linearGetSize (void *mem)
 Retrieves the allocated size of a buffer. More...
 
void linearFree (void *mem)
 Frees a buffer. More...
 
u32 linearSpaceFree (void)
 Gets the current linear free space. More...
 

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.