L4Re - L4 Runtime Environment
cxx::List_alloc Class Reference

Standard list-based allocator. More...

+ Collaboration diagram for cxx::List_alloc:

Public Member Functions

 List_alloc ()
 Initializes an empty list allocator. More...
 
void free (void *block, unsigned long size, bool initial_free=false)
 Return a free memory block to the allocator. More...
 
void * alloc (unsigned long size, unsigned align)
 Alloc a memory block. More...
 
void * alloc_max (unsigned long min, unsigned long *max, unsigned align, unsigned granularity)
 Allocate a memory block of min <= size <=max. More...
 
unsigned long avail ()
 Get the amount of available memory. More...
 

Detailed Description

Standard list-based allocator.

Definition at line 31 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 56 of file list_alloc.

References alloc(), alloc_max(), avail(), L4::cerr, free(), cxx::max(), and cxx::min().

+ Here is the call graph for this function:

Member Function Documentation

◆ alloc()

void * cxx::List_alloc::alloc ( unsigned long  size,
unsigned  align 
)
inline

Alloc a memory block.

Parameters
sizeSize of the memory block
alignAlignment constraint
Returns
Pointer to memory block

Definition at line 354 of file list_alloc.

Referenced by List_alloc().

+ Here is the caller graph for this function:

◆ alloc_max()

void * cxx::List_alloc::alloc_max ( unsigned long  min,
unsigned long *  max,
unsigned  align,
unsigned  granularity 
)
inline

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

Parameters
minMinimal size to allocate.
[in,out]maxMaximum size to allocate. The actual allocated size is returned here.
alignAlignment constraint.
granularityGranularity to use for the allocation.
Returns
Pointer to memory block

Definition at line 257 of file list_alloc.

References l4_round_size(), l4_trunc_size(), and cxx::max().

Referenced by List_alloc().

+ Here is the call graph for this function:
+ Here is the caller 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 425 of file list_alloc.

Referenced by List_alloc().

+ Here is the caller graph for this function:

◆ 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.

Definition at line 218 of file list_alloc.

Referenced by List_alloc().

+ Here is the caller graph for this function:

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