COMBINATORIAL_BLAS  1.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Friends
MemoryPool Class Reference

#include <MemoryPool.h>

List of all members.

Public Member Functions

 MemoryPool (void *m_beg, size_t m_size)
void * alloc (size_t size)
void dealloc (void *base, size_t size)

Friends

ofstream & operator<< (ofstream &outfile, const MemoryPool &mpool)
 Dump the contents of the pinned memory.

Detailed Description

Invariant:
Available memory addresses will be sorted w.r.t. their starting positions
At least one element exists in the freelist at any time.
Defragment on the fly: at any time, NO two consecutive chunks with chunk1.endaddr equals chunk2.begaddr exist

Definition at line 48 of file MemoryPool.h.


Constructor & Destructor Documentation

MemoryPool::MemoryPool ( void *  m_beg,
size_t  m_size 
)

Definition at line 3 of file MemoryPool.cpp.


Member Function Documentation

void * MemoryPool::alloc ( size_t  size)

Definition at line 9 of file MemoryPool.cpp.

void MemoryPool::dealloc ( void *  base,
size_t  size 
)

defragment on the fly by attaching to the previous chunk if prevchunk.endaddr equals newitem.beginaddr, or by attaching to the next available chunk if newitem.endaddr equals nextchunk.begaddr

check the next chunk to see if we perfectly fill the hole

Insert x before pos: 'iterator insert(iterator pos, const T& x)'

Definition at line 27 of file MemoryPool.cpp.


Friends And Related Function Documentation

ofstream& operator<< ( ofstream &  outfile,
const MemoryPool mpool 
)
friend

Dump the contents of the pinned memory.

Definition at line 107 of file MemoryPool.cpp.


The documentation for this class was generated from the following files: