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

Standard list-based allocator. More...

#include <list_alloc>

+ Collaboration diagram for cxx::List_alloc:

Public Member Functions

 List_alloc ()
 Initializes an empty list allocator.
 
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 ()
 Get the amount of available memory.
 

Detailed Description

Standard list-based allocator.

Definition at line 32 of file list_alloc.

Constructor & Destructor Documentation

◆ List_alloc()

cxx::List_alloc::List_alloc ( )
inline

Initializes an empty list allocator.

Note
To initialize the allocator with available memory use the free() function.

Definition at line 57 of file list_alloc.

Member Function Documentation

◆ alloc()

void * cxx::List_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 400 of file list_alloc.

◆ alloc_max()

void * cxx::List_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 280 of file list_alloc.

References l4_round_size(), and l4_trunc_size().

+ Here is the call graph for this function:

◆ avail()

unsigned long cxx::List_alloc::avail ( )
inline

Get the amount of available memory.

Returns
Available memory in bytes

Definition at line 488 of file list_alloc.

◆ free()

void cxx::List_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 239 of file list_alloc.


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