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 | ) |

Allocates a 0x80-byte aligned buffer.

Parameters

  size | Size of the buffer to allocate.

Returns
  The allocated buffer.

Examples
  audio/filters/source/main.c, audio/mic/source/main.c, audio/streaming/source/main.c, graphics/gpu/both_screens/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/lenny/source/main.c, graphics/gpu/loop_subdivision/source/main.c, graphics/gpu/mipmap_fog/source/main.c, graphics/gpu/particles/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, and graphics/gpu/toon_shading/source/main.c.

## linearFree()

void linearFree | ( | void * | mem | ) |

Frees a buffer.

Parameters

  mem | Buffer to free.

Examples
  audio/filters/source/main.c, audio/mic/source/main.c, audio/streaming/source/main.c, graphics/gpu/both_screens/source/main.c, graphics/gpu/fragment_light/source/main.c, graphics/gpu/geoshader/source/main.c, graphics/gpu/lenny/source/main.c, graphics/gpu/loop_subdivision/source/main.c, graphics/gpu/mipmap_fog/source/main.c, graphics/gpu/particles/source/main.c, graphics/gpu/simple_tri/source/main.c, graphics/gpu/textured_cube/source/main.c, graphics/gpu/toon_shading/source/main.c, and mvd/source/main.c.

## 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

  size | Size of the buffer to allocate.
  alignment | Alignment 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

  mem | Buffer to reallocate.
  size | Size 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.