#include <Arena.H>
Inheritance diagram for CArena:


Public Types | |
| enum | { DefaultHunkSize = 1024*1024 } |
| The default memory hunk size to grab from the heap. More... | |
Public Member Functions | |
| CArena (size_t hunk_size=0) | |
| virtual | ~CArena () |
| The destructor. | |
| virtual void * | alloc (size_t nbytes) |
| Allocate some memory. | |
| virtual void | free (void *ap) |
| void * | calloc (size_t nmemb, size_t size) |
| void * | realloc (void *ptr, size_t size) |
Protected Types | |
| typedef set< Node > | NL |
Protected Attributes | |
| std::vector< void * > | m_alloc |
| NL | m_freelist |
| NL | m_busylist |
| size_t | m_hunk |
This is a coalescing memory manager. It allocates (possibly) large chunks of heap space and apportions it out as requested. It merges together neighboring chunks on each free().
|
|
|
|
|
The default memory hunk size to grab from the heap.
|
|
|
: Construct a coalescing memory manager. `hunk_size' is the minimum size of hunks of memory to allocate from the heap. If hunk_size == 0 we use DefaultHunkSize as specified below. |
|
|
The destructor.
|
|
|
Allocate some memory.
Implements Arena. |
|
||||||||||||
|
Mirror the C calloc() function. Returns zero'd memory of size nmemb*size. This is here so that we can implement malloc(3) and family. User's shouldn't use this function. |
|
|
Free up allocated memory. Merge neighboring free memory chunks into largest possible chunk. Implements Arena. |
|
||||||||||||
|
Mirror the C realloc() function. This is here so that we can implement malloc(3) and family. User's shouldn't use this function. |
|
|
|
|
|
|
|
|
|
|
|
|
1.3.2