#include <slaballoc.h>
Collaboration diagram for Slab_allocator:

Public Member Functions | |
| void | init (unsigned size, bool physical_memory=false) |
| void * | alloc () |
| void | free (void *object) |
| void | clear () |
| unsigned | flush () |
| unsigned | get_object_size () const |
| void | touch () |
Protected Member Functions | |
| Slab * | find_slab_with_free_object () |
| Slab * | alloc_slab () |
Protected Attributes | |
| unsigned | object_size |
| Slab * | current_slab |
| List< Slab > | free_slabs |
| List< Slab > | used_slabs |
| bool | physical |
|
|
Allocate a chunk of memory from one of the slabs this allocator manages.
|
|
|
Allocate a new slab and add it to this slab allocator's free_slabs list.
|
|
|
Free and flush all slabs managed by this allocator.
|
|
|
Return a slab with at least one free object.
|
|
|
Return any completely free slabs back to the underlying page allocator.
|
|
|
Free the given chunk of memory from one of the slabs of this allocator.
|
|
|
|
|
||||||||||||
|
Initialize this slab allocator with the given object size, using either virtual or physical memory.
|
|
|
|
|
|
current slab where allocs happen
|
|
|
empty slabs; may be safely flushed
|
|
|
size of objects in managed slabs
|
|
|
whether physical memory is used
|
|
|
slabs with objects; do not flush
|
Torsion Operating System, Copyright (C) 2000-2004 Dan Helfman