L4Re Operating System Framework
Interface and Usage Documentation
|
Merged slab allocator (allocators for objects of the same size are merged together). More...
#include <slab_alloc>
Public Types | |
enum | { object_size = Obj_size , slab_size = Slab_size , objects_per_slab = _A::objects_per_slab , max_free_slabs = Max_free } |
Public Member Functions | |
void * | alloc () noexcept |
Allocate an object. | |
void | free (void *p) noexcept |
Free the given object (p ). | |
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 free objects in the slab allocator. | |
Merged slab allocator (allocators for objects of the same size are merged together).
Obj_size | The size of an object managed by the slab allocator. |
Slab_size | The size of a slab. |
Max_free | The maximum number of free slabs. |
Alloc | The allocator for the slabs. |
This slab allocator class is useful for merging slab allocators with the same parameters (equal Obj_size
, Slab_size
, Max_free
, and Alloc
parameters) together and share the overhead for the slab caches among all equal-sized objects.
Definition at line 399 of file slab_alloc.
anonymous enum |
Enumerator | |
---|---|
object_size | Size of an object. |
slab_size | Size of a slab. |
objects_per_slab | Number of objects per slab. |
max_free_slabs | Maximum number of free slabs. |
Definition at line 406 of file slab_alloc.
|
inlinenoexcept |
Allocate an object.
Definition at line 423 of file slab_alloc.
References cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::alloc().
|
inlinenoexcept |
Free the given object (p
).
p | The pointer to the object to free. |
p
must be a pointer to an object allocated by this allocator. Definition at line 431 of file slab_alloc.
References cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::free().
|
inlinenoexcept |
Get the number of free objects in the slab allocator.
Definition at line 451 of file slab_alloc.
References cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::free_objects().
|
inlinenoexcept |
Get the total number of objects managed by the slab allocator.
Definition at line 441 of file slab_alloc.
References cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::total_objects().