#include <MemCache.hpp>
Public Member Functions | |
MemCache (int cachesize) | |
MemCache (int *cache, int cachesize) | |
use the given memory | |
MemCache () | |
~MemCache () | |
int * | getMem (int chunksize) |
int * | getMoreMem (int newsize, int *location, int oldsize) |
void | freeMem (int *location, int memsize) |
void | flushMem () |
const int * | getBegin () |
const int * | getEnd () |
Private Member Functions | |
int * | getFromFree (int csize) |
Private Attributes | |
int * | begin |
int | size |
point to the start of our cache | |
int * | end |
the size of our cache | |
int | intsize |
index of where free memory begins | |
vector< int * > | freelist [NLISTS] |
sizeof(int) value | |
bool | ourmem |
array of lists of free memory |
|
constructor
|
|
use the given memory
|
|
default constructor that doesn't do much |
|
destructor free the memory we allocated |
|
reinitializes |
|
"free" the memory at this pointer this cache will remember it in the free list this does not mean delete the memory
|
|
|
|
|
|
returns pointer to memory holes if available returns NULL if nothing is available
|
|
|
|
returns pointer to a new location of newsize containing all the elements of the old location
|
|
|
|
the size of our cache
|
|
sizeof(int) value
|
|
index of where free memory begins
|
|
array of lists of free memory
|
|
point to the start of our cache
|