name: MemoryManager

synopsis:

g++ [flags ...] file ... -l /isip/tools/lib/$ISIP_BINARY/lib_system.a

#include <MemoryManager.h>

MemoryManager();
void* get();
boolean release(voidp ptr);
quick start:

// declare MemoryManager object in TRACK mode
//
MemoryManager mgr_t(sizeof(float), 1024, TRACK);

// declare local variable
//
long size = 100;

// allocate a chunk of contiguous memory
//
float** ptrs_t = (float**)mgr_t.getBlock(size * sizeof(float*));

// release that chunk of contiguous memory
//
mgr_t.releaseBlock(ptrs_t);

description:

The MemoryManager class handles all dynamic memory allocation and deletion. Its primary design speeds up (via block allocation) programs where many objects of the same size are allocated and deleted over time. All objects (scalars and above) override the new and delete methods by means of the MemoryManager, resulting in a significant speedup in dynamic data structures such as graphs and lists.

We support two different modes, TRACK and OPTIMIZE. MemoryManagerTrack is not time efficient and is used when we need to track what happens to memory when it is allocated or released. MemoryManagerOptimize preserves identically-sized blocks of memory. It increases efficiency when we need to allocate a large number of identically-sized blocks. MemoryManagerOptimize and MemoryManagerTrack classes inherit the MemoryManagerBase class, which has virtual functions.

The MemoryMangerBase class defines the interface contract for MemoryManagerOptimize and MemoryManagerTrack. The MemoryManager class has a virtual pointer to either an optimized or tracking MemoryManager. MemoryManagerBase includes virtual functions. Thus, the actual function used is the one defined in the dynamic type of the class reference that invokes it.

dependencies:

public constants:

error codes:

protected data:

required public methods:

class-specific public methods:

private methods:

examples:

notes: