L4Re - L4 Runtime Environment
cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc > Class Template Reference

Basic slab allocator. More...

+ Inheritance diagram for cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >:
+ Collaboration diagram for cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >:

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 allocator for the slab caches.
 

Public Member Functions

unsigned total_objects () const throw ()
 Get the total number of objects managed by the slab allocator. More...
 
unsigned free_objects () const throw ()
 Get the total number of objects managed by the slab allocator. More...
 

Detailed Description

template<int Obj_size, int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
class cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >

Basic slab allocator.

Parameters
Obj_sizeThe size of the objects managed by the allocator (in bytes).
Slab_sizeThe size of a slab cache (in bytes).
Max_freeThe maximum number of free slab caches. When this limit is reached slab caches are freed.
AllocThe allocator that is used to allocate the slab caches.

Definition at line 40 of file slab_alloc.

Member Enumeration Documentation

◆ anonymous enum

template<int Obj_size, int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
anonymous enum
Enumerator
object_size 

size of an object.

slab_size 

size of a slab cache.

objects_per_slab 

objects per slab cache.

max_free_slabs 

maximum number of free slab caches.

Definition at line 63 of file slab_alloc.

Member Function Documentation

◆ free_objects()

template<int Obj_size, int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
unsigned cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::free_objects ( ) const
throw (
)
inline

Get the total number of objects managed by the slab allocator.

Returns
The number of objects managed by the allocator (including the free objects).

Definition at line 271 of file slab_alloc.

◆ total_objects()

template<int Obj_size, int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
unsigned cxx::Base_slab< Obj_size, Slab_size, Max_free, Alloc >::total_objects ( ) const
throw (
)
inline

Get the total number of objects managed by the slab allocator.

Returns
The number of objects managed by the allocator (including the free objects).

Definition at line 263 of file slab_alloc.


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