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

Slab allocator for object of type Type. More...

+ Inheritance diagram for cxx::Slab< Type, Slab_size, Max_free, Alloc >:
+ Collaboration diagram for cxx::Slab< Type, Slab_size, Max_free, Alloc >:

Public Member Functions

Type * alloc () throw ()
 Allocate an object of type Type. More...
 
void free (Type *o) throw ()
 Free the object addressed by o. More...
 
- Public Member Functions inherited from cxx::Base_slab< sizeof(Type), Slab_size, Max_free, Alloc >
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...
 

Additional Inherited Members

- Public Types inherited from cxx::Base_slab< sizeof(Type), Slab_size, Max_free, Alloc >
typedef Alloc< Slab_i > Slab_alloc
 Type of the allocator for the slab caches.
 

Detailed Description

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

Slab allocator for object of type Type.

Parameters
Typethe type of the objects to manage.
Slab_sizesize of a slab cache.
Max_freethe maximum number of free slab caches.
Allocthe allocator for the slab caches.

Definition at line 297 of file slab_alloc.

Member Function Documentation

◆ alloc()

template<typename Type , int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
Type* cxx::Slab< Type, Slab_size, Max_free, Alloc >::alloc ( )
throw (
)
inline

Allocate an object of type Type.

Returns
A pointer to the object just allocated, or 0 on failure.

Definition at line 314 of file slab_alloc.

◆ free()

template<typename Type , int Slab_size = L4_PAGESIZE, int Max_free = 2, template< typename A > class Alloc = New_allocator>
void cxx::Slab< Type, Slab_size, Max_free, Alloc >::free ( Type *  o)
throw (
)
inline

Free the object addressed by o.

Parameters
oThe pointer to the object to free.
Precondition
The object must have been allocated with this allocator.

Definition at line 325 of file slab_alloc.


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