MemoryPool Class Reference

#include <MemoryPool.h>

Inheritance diagram for MemoryPool:
Object

# Static Public Member Functions

static BYTEallocate (int32 numBytes)
static void free (BYTE *object)
static void printResumedUsage (int32 x, int32 y)
static void printDetailedUsage (int32 x, int32 y)

# Protected Attributes

__MEMORY_POOL_ARRAYS BYTEpoolLocation [__MEMORY_POOLS]
 The actual blocks that constitute the memory pools.
uint16 poolSizes [__MEMORY_POOLS][2]
 Mapping of memory pools to their block and total size.
BYTEpoolLastFreeBlock [__MEMORY_POOLS]
 Array of pointers to the last free block found in each pool to accelerate the next search.

# Additional Inherited Members

- Private Member Functions inherited from Object
void constructor ()
 Class' constructor.
const void * getVTable ()
bool mutateTo (const void *targetClass)
- Static Private Member Functions inherited from Object
static Object getCast (void *object, ClassPointer targetClassGetClassMethod, ClassPointer baseClassGetClassMethod)
- Private Attributes inherited from Object
void * vTable
 Pointer to the class's virtual table.

# Detailed Description

Class MemoryPool

Inherits from Object

Implements a memory pool for dynamic object allocation.

Definition at line 54 of file MemoryPool.h.

# Member Function Documentation

# allocate()

static BYTE * MemoryPool::allocate ( int32 numBytes)
static

Allocate a block big enough to hold the provided amount of bytes.

Parameters
numBytesTotal number of bytes to allocate
Returns
A pointer to the allocated block

Definition at line 41 of file MemoryPool.c.

# free()

static void MemoryPool::free ( BYTE * object)
static

Free the memory block in which the provided object was allocated.

Parameters
objectPointer to the memory block to free

Definition at line 206 of file MemoryPool.c.

# printDetailedUsage()

static void MemoryPool::printDetailedUsage ( int32 x,
int32 y )
static

Print all the details of the memory usage.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 319 of file MemoryPool.c.

# printResumedUsage()

static void MemoryPool::printResumedUsage ( int32 x,
int32 y )
static

Print a resume of the memory usage.

Parameters
xScreen x coordinate where to print
yScreen y coordinate where to print

Definition at line 264 of file MemoryPool.c.

# Member Data Documentation

# poolLastFreeBlock

BYTE* MemoryPool::poolLastFreeBlock[__MEMORY_POOLS]
protected

Array of pointers to the last free block found in each pool to accelerate the next search.

Definition at line 68 of file MemoryPool.h.

# poolLocation

__MEMORY_POOL_ARRAYS BYTE* MemoryPool::poolLocation[__MEMORY_POOLS]
protected

The actual blocks that constitute the memory pools.

Array of pointers to the beginning of each memory pool

Definition at line 62 of file MemoryPool.h.

# poolSizes

uint16 MemoryPool::poolSizes[__MEMORY_POOLS][2]
protected

Mapping of memory pools to their block and total size.

Definition at line 65 of file MemoryPool.h.


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