L4Re Operating System Framework
Interface and Usage Documentation
Loading...
Searching...
No Matches
cxx::Tree_alloc Class Reference

Standard tree-based allocator. More...

#include <tree_alloc>

Collaboration diagram for cxx::Tree_alloc:

Public Member Functions

void free (void *block, unsigned long size, bool initial_free=false)
 Return a free memory block to the allocator.
void * alloc (unsigned long size, unsigned long align, unsigned long lower=0, unsigned long upper=~0UL)
 Allocate a memory block.
void * alloc_max (unsigned long min, unsigned long *max, unsigned long align, unsigned granularity, unsigned long lower=0, unsigned long upper=~0UL)
 Allocate a memory block of min <= size <= max.
unsigned long avail () const
 Get the amount of available memory.

Detailed Description

Standard tree-based allocator.

Definition at line 28 of file tree_alloc.

Member Function Documentation

◆ alloc()

void * cxx::Tree_alloc::alloc ( unsigned long size,
unsigned long align,
unsigned long lower = 0,
unsigned long upper = ~0UL )
inline

Allocate a memory block.

Parameters
sizeSize of the memory block.
alignAlignment constraint.
lowerLower bound of the physical region the memory block should be allocated from.
upperUpper bound of the physical region the memory block should be allocated from, value is inclusive.
Returns
Pointer to memory block
Precondition
0 < size <= ~0UL - 32.

Definition at line 377 of file tree_alloc.

◆ alloc_max()

void * cxx::Tree_alloc::alloc_max ( unsigned long min,
unsigned long * max,
unsigned long align,
unsigned granularity,
unsigned long lower = 0,
unsigned long upper = ~0UL )
inline

Allocate a memory block of min <= size <= max.

Parameters
minMinimal size to allocate (in bytes).
[in,out]maxMaximum size to allocate (in bytes). The actual allocated size is returned here.
alignAlignment constraint.
granularityGranularity to use for the allocation (power of 2).
lowerLower bound of the physical region the memory block should be allocated from.
upperUpper bound of the physical region the memory block should be allocated from, value is inclusive.
Returns
Pointer to memory block
Precondition
0 < min <= ~0UL - 32.
0 < max.

Definition at line 262 of file tree_alloc.

References l4_round_size(), and l4_trunc_size().

Here is the call graph for this function:

◆ avail()

unsigned long cxx::Tree_alloc::avail ( ) const
inline

Get the amount of available memory.

Returns
Available memory in bytes

Definition at line 458 of file tree_alloc.

◆ free()

void cxx::Tree_alloc::free ( void * block,
unsigned long size,
bool initial_free = false )
inline

Return a free memory block to the allocator.

Parameters
blockPointer to memory block.
sizeSize of memory block.
initial_freeSet to true for putting fresh memory to the allocator. This will enforce alignment on that memory.
Precondition
block must not be NULL.
2 * sizeof(void *) <= size <= ~0UL - 32.

Definition at line 217 of file tree_alloc.


The documentation for this class was generated from the following file: