Public Member Functions |
|
| SimpleAllocator (size_t max_size, Mutex &lock) |
| SimpleAllocatorBlock * | alloc (size_t size) |
| | Allocates a new block.
|
| size_t | get_contiguous () const |
| | Returns an upper-bound estimate of the size of the largest contiguous block that may be allocated.
|
| SimpleAllocatorBlock * | get_first_block () const |
| | Returns a pointer to the first allocated block, or NULL if there are no allocated blocks.
|
| size_t | get_max_size () const |
| | Returns the available space for allocated objects.
|
| size_t | get_total_size () const |
| | Returns the total size of allocated objects.
|
| bool | is_empty () const |
| | Returns true if there are no blocks allocated on this page, or false if there is at least one.
|
|
void | output (ostream &out) const |
| void | set_max_size (size_t max_size) |
| | Changes the available space for allocated objects.
|
|
void | write (ostream &out) const |
Protected Member Functions |
| virtual void | changed_contiguous () |
| | This callback function is made whenever the estimate of contiguous available space changes, either through an alloc or free.
|
| SimpleAllocatorBlock * | do_alloc (size_t size) |
| | Allocates a new block.
|
| bool | do_is_empty () const |
| | Returns true if there are no blocks allocated on this page, or false if there is at least one.
|
| virtual SimpleAllocatorBlock * | make_block (size_t start, size_t size) |
| | Creates a new SimpleAllocatorBlock object.
|
| void | mark_contiguous (const LinkedListNode *block) |
| | Some space has been made available following the indicated block.
|
Protected Attributes |
|
size_t | _contiguous |
|
Mutex & | _lock |
|
size_t | _max_size |
|
size_t | _total_size |
Friends |
|
class | SimpleAllocatorBlock |
An implementation of a very simple block allocator.
This class can allocate ranges of nonnegative integers within a specified upper limit; it uses a simple first-fit algorithm to find the next available space.
Definition at line 33 of file simpleAllocator.h.