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

Merged slab allocator (allocators for objects of the same size are merged together). More...

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

Public Member Functions

Type * alloc () throw ()
 Allocate an object of type Type. More...
 
- Public Member Functions inherited from cxx::Base_slab_static< sizeof(Type), Slab_size, Max_free, Alloc >
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...
 

Detailed Description

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

Merged slab allocator (allocators for objects of the same size are merged together).

Parameters
TypeThe type of the objects to manage.
Slab_sizeThe size of a slab cache.
Max_freeThe maximum number of free slab caches.
AllocThe allocator for the slab caches.

This slab allocator class is useful for merging slab allocators with the same parameters (equal sizeof(Type), Slab_size, Max_free, and Alloc parameters) together and share the overhead for the slab caches among all equal-sized objects.

Definition at line 415 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_static< Type, Slab_size, Max_free, Alloc >::alloc ( )
throw (
)
inline

Allocate an object of type Type.

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

Definition at line 425 of file slab_alloc.


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