![]() |
L4Re Operating System Framework
Interface and Usage Documentation
|
Basic slab allocator. More...
#include <slab_alloc>
Data Structures | |
struct | Slab_i |
Type of a slab. More... |
Public Types | |
enum | { object_size = Obj_size , slab_size = Slab_size , objects_per_slab = (Slab_size - sizeof(Slab_head)) / object_size , max_free_slabs = Max_free } |
typedef Alloc< Slab_i > | Slab_alloc |
Type of the backend allocator. |
Public Member Functions | |
void * | alloc () noexcept |
Allocate a new object. | |
void | free (void *_o) noexcept |
Free the given object (_o). | |
unsigned | total_objects () const noexcept |
Get the total number of objects managed by the slab allocator. | |
unsigned | free_objects () const noexcept |
Get the number of objects which can be allocated before a new empty slab needs to be added to the slab allocator. |
Basic slab allocator.
Obj_size | The size of the objects managed by the allocator (in bytes). |
Slab_size | The size of a slab (in bytes). |
Max_free | The maximum number of free slabs. When this limit is reached slabs are freed, provided that the backend allocator supports allocated memory to be freed. |
Alloc | The backend allocator used to allocate slabs. |
Definition at line 31 of file slab_alloc.
anonymous enum |
Enumerator | |
---|---|
object_size | Size of an object. |
slab_size | Size of a slab. |
objects_per_slab | Objects per slab. |
max_free_slabs | Maximum number of free slabs. |
Definition at line 65 of file slab_alloc.
|
inlinenoexcept |
Allocate a new object.
Definition at line 207 of file slab_alloc.
|
inlinenoexcept |
Free the given object (_o).
Definition at line 246 of file slab_alloc.
|
inlinenoexcept |
Get the number of objects which can be allocated before a new empty slab needs to be added to the slab allocator.
Definition at line 308 of file slab_alloc.
|
inlinenoexcept |
Get the total number of objects managed by the slab allocator.
Definition at line 299 of file slab_alloc.