L4Re - L4 Runtime Environment
|
Merged slab allocator (allocators for objects of the same size are merged together). More...
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 () throw () |
Allocate an object. More... | |
void | free (void *p) throw () |
Free the given object (p). More... | |
unsigned | total_objects () const throw () |
Get the total number of objects managed by the slab allocator. More... | |
unsigned | free_objects () const throw () |
Get the number of free objects in the slab allocator. More... | |
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 cache. |
Max_free | The maximum number of free slab caches. |
Alloc | The allocator for the slab caches. |
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 348 of file slab_alloc.
anonymous enum |
Enumerator | |
---|---|
object_size | size of an object. |
slab_size | size of a slab cache. |
objects_per_slab | number of objects per slab cache. |
max_free_slabs | maximum number of free slab caches. |
Definition at line 355 of file slab_alloc.
|
inline |
Allocate an object.
Definition at line 365 of file slab_alloc.
|
inline |
Free the given object (p).
p | The pointer to the object to free. |
Definition at line 371 of file slab_alloc.
|
inline |
Get the number of free objects in the slab allocator.
Definition at line 389 of file slab_alloc.
|
inline |
Get the total number of objects managed by the slab allocator.
Definition at line 380 of file slab_alloc.