CoinAlloc Class Reference

A memory pool allocator. More...

#include <CoinAlloc.hpp>

Collaboration diagram for CoinAlloc:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CoinAlloc ()
 ~CoinAlloc ()
void * alloc (const std::size_t n)
void dealloc (void *p)

Private Attributes

CoinMempoolpool_
int maxpooled_

Detailed Description

A memory pool allocator.

If a request arrives for allocating n bytes then it is first rounded up to the nearest multiple of sizeof(void*) (this is n_roundup), then one more sizeof(void*) is added to this number. If the result is no more than maxpooled_ then the appropriate pool is used to get a chunk of memory, if not, then malloc is used. In either case, the size of the allocated chunk is written into the first sizeof(void*) bytes and a pointer pointing afterwards is returned.

Definition at line 115 of file CoinAlloc.hpp.


Constructor & Destructor Documentation

CoinAlloc::CoinAlloc (  ) 
CoinAlloc::~CoinAlloc (  )  [inline]

Definition at line 122 of file CoinAlloc.hpp.


Member Function Documentation

void* CoinAlloc::alloc ( const std::size_t  n  )  [inline]

Definition at line 124 of file CoinAlloc.hpp.

void CoinAlloc::dealloc ( void *  p  )  [inline]

Definition at line 145 of file CoinAlloc.hpp.


Member Data Documentation

Definition at line 118 of file CoinAlloc.hpp.

int CoinAlloc::maxpooled_ [private]

Definition at line 119 of file CoinAlloc.hpp.


The documentation for this class was generated from the following file:
Generated on Fri Jul 2 21:11:39 2010 by  doxygen 1.6.3