COMBINATORIAL_BLAS  1.6
combblas::MemoryPool Class Reference

#include <MemoryPool.h>

Public Member Functions

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

Friends

std::ofstream & operator<< (std::ofstream &outfile, const MemoryPool &mpool)
 

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 66 of file MemoryPool.h.

Constructor & Destructor Documentation

◆ MemoryPool()

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

Definition at line 36 of file MemoryPool.cpp.

Member Function Documentation

◆ alloc()

void * combblas::MemoryPool::alloc ( size_t  size)

Definition at line 42 of file MemoryPool.cpp.

◆ dealloc()

void combblas::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 60 of file MemoryPool.cpp.

Friends And Related Function Documentation

◆ operator<<

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

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