L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
umalloc.h File Reference

Public API for the basic next-fit memory allocator. More...

#include <stddef.h>
#include <l4/sys/compiler.h>
Include dependency graph for umalloc.h:

Go to the source code of this file.

Functions

void * umalloc_area_create (size_t area_size) L4_NOTHROW
 Create a new heap area.

Variables

L4_BEGIN_DECLS size_t umalloc_area_granularity
 Heap area granularity.

Detailed Description

Public API for the basic next-fit memory allocator.

The user of this allocator is required to provide the implementation of the umalloc_area_create() function and provide the umalloc_area_granularity symbol with a value.

Note
The current implementation is NOT thread-safe. If the user wants to use this allocator concurrently, they need to deploy their custom mutual exclusion mechanism around the public calls to the allocator.

Definition in file umalloc.h.

Function Documentation

◆ umalloc_area_create()

void * umalloc_area_create ( size_t area_size)

Create a new heap area.

Parameters
area_sizeRequested heap area size. Always a multiple of the heap area granularity as reported by umalloc_area_granularity().
Returns
Pointer to the successfully created heap area of (at least) the requested size. It is assumed that the pointer satisfies at least the umalloc::Base_alignment alignment. If the value is nullptr, then it is assumed that the creation of the heap area failed.

References L4_END_DECLS, and L4_NOTHROW.

Variable Documentation

◆ umalloc_area_granularity

L4_BEGIN_DECLS size_t umalloc_area_granularity
extern

Heap area granularity.

The allocator only requests the creation of heap areas with this granularity.