MOS Source Code
Loading...
Searching...
No Matches
slab.hpp File Reference
#include <mos/lib/structures/list.hpp>
#include <mos/lib/sync/spinlock.hpp>
#include <mos/string.hpp>
#include <mos/string_view.hpp>
#include <mos/type_utils.hpp>
#include <stddef.h>
Include dependency graph for slab.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  slab_t
struct  Slab< T >

Namespaces

namespace  mos

Functions

void slab_init ()
 initialise the slab allocator
voidslab_alloc (size_t size)
 Allocate a block of memory from the slab allocator.
voidslab_calloc (size_t nmemb, size_t size)
 Allocate a block of memory from the slab allocator and zero it.
voidslab_realloc (void *addr, size_t size)
 Reallocate a block of memory from the slab allocator.
void slab_free (const void *addr)
 Free a block of memory from the slab allocator.
void slab_register (slab_t *slab)
voidkmemcache_alloc (slab_t *slab)
void kmemcache_free (slab_t *slab, const void *addr)

Function Documentation

◆ slab_init()

void slab_init ( )

initialise the slab allocator

Definition at line 112 of file slab.cpp.

Referenced by setup_sane_environment().

Here is the call graph for this function:

◆ slab_alloc()

void * slab_alloc ( size_t size)

Allocate a block of memory from the slab allocator.

Parameters
size
Returns
void*

Definition at line 126 of file slab.cpp.

Referenced by slab_calloc(), and slab_realloc().

Here is the call graph for this function:

◆ slab_calloc()

void * slab_calloc ( size_t nmemb,
size_t size )

Allocate a block of memory from the slab allocator and zero it.

Parameters
nmemb
size
Returns
void*

Definition at line 144 of file slab.cpp.

Here is the call graph for this function:

◆ slab_realloc()

void * slab_realloc ( void * addr,
size_t size )

Reallocate a block of memory from the slab allocator.

Parameters
addr
size
Returns
void*

Definition at line 154 of file slab.cpp.

Here is the call graph for this function:

◆ slab_free()

void slab_free ( const void * addr)

Free a block of memory from the slab allocator.

Parameters
addr

Definition at line 196 of file slab.cpp.

Referenced by slab_realloc().

Here is the call graph for this function:

◆ slab_register()

void slab_register ( slab_t * slab)

Definition at line 119 of file slab.cpp.

Referenced by Slab< T >::create().

Here is the call graph for this function:

◆ kmemcache_alloc()

void * kmemcache_alloc ( slab_t * slab)

Definition at line 216 of file slab.cpp.

Referenced by Slab< T >::create(), and slab_alloc().

Here is the call graph for this function:

◆ kmemcache_free()

void kmemcache_free ( slab_t * slab,
const void * addr )

Definition at line 242 of file slab.cpp.

Referenced by slab_free(), and slab_realloc().