Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

CArena Class Reference

#include <Arena.H>

Inheritance diagram for CArena:

Inheritance graph
[legend]
Collaboration diagram for CArena:

Collaboration graph
[legend]
List of all members.

Detailed Description

A Concrete Class for Dynamic Memory Management.

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 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)

Private Member Functions

 CArena (const CArena &rhs)
CArenaoperator= (const CArena &rhs)


Member Enumeration Documentation

anonymous enum
 

The default memory hunk size to grab from the heap.

Enumeration values:
DefaultHunkSize 


Constructor & Destructor Documentation

CArena::CArena size_t  hunk_size = 0  ) 
 

: 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.

virtual CArena::~CArena  )  [virtual]
 

The destructor.

CArena::CArena const CArena rhs  )  [private]
 


Member Function Documentation

virtual void* CArena::alloc size_t  nbytes  )  [virtual]
 

Allocate some memory.

Implements Arena.

virtual void CArena::free void *  ap  )  [virtual]
 

Free up allocated memory. Merge neighboring free memory chunks into largest possible chunk.

Implements Arena.

void* CArena::calloc size_t  nmemb,
size_t  size
 

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.

void* CArena::realloc void *  ptr,
size_t  size
 

Mirror the C realloc() function. This is here so that we can implement malloc(3) and family. User's shouldn't use this function.

CArena& CArena::operator= const CArena rhs  )  [private]
 


The documentation for this class was generated from the following file:
Generated on Fri Jul 2 17:55:44 2004 for Chombo by doxygen 1.3.2