#include <Arena.H>
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().
Public Types | |
enum | { DefaultHunkSize = 1024*1024 } |
The default memory hunk size to grab from the heap. More... | |
Public Member Functions | |
CArena (size_t a_hunk_size=0) | |
virtual | ~CArena () |
The destructor. | |
virtual void * | alloc (size_t a_nbytes) |
Allocate some memory. | |
virtual void | free (void *a_vp) |
Private Member Functions | |
CArena (const CArena &a_rhs) | |
CArena & | operator= (const CArena &a_rhs) |
CArena::CArena | ( | size_t | a_hunk_size = 0 |
) |
: Construct a coalescing memory manager. `a_hunk_size' is the minimum size of hunks of memory to allocate from the heap. If a_hunk_size == 0 we use DefaultHunkSize as specified below.
virtual CArena::~CArena | ( | ) | [virtual] |
The destructor.
CArena::CArena | ( | const CArena & | a_rhs | ) | [private] |
virtual void* CArena::alloc | ( | size_t | a_nbytes | ) | [virtual] |
virtual void CArena::free | ( | void * | a_vp | ) | [virtual] |
Free up allocated memory. Merge neighboring free memory chunks into largest possible chunk.
Implements Arena.