MemPool

Description: Fixed size block memory allocator interface

Source file: …\genesis3d\OpenSource\Source\Support\mempool.h

Contents:

Functions: Create, Extend, Destroy, Reset, GetHunk, FreeHunk, IsValid

Types: MemPool

Notes: view

Additions to Genesis3D v1.6: None

Notes:

(From mempool.c)

MemPool is a 'root' level object (eg. 'list' uses us). We sit only above 'Ram' in the heirarchy

MemPool

     Is a system for fast Resetting & Freeing of nodes; for use in tree structures

    Requires no traversing for freeing

     Does auto-extending of memory space in case you use more space than expected or if you don't know how much you will need

HunkLength is forced to be a multiple of 4

 

(from mempool.h)

NOTEZ: MemPool_Get clears the memory block to zeros

 

Return to Contents

Types: 

typedef struct MemPool MemPool;

NOTE: The contents of this structure have been intentionally left out of the interface, by the designers of this module. Think of this as a handle only. 

 Return to Contents

Functions:

extern MemPool* MemPool_Create(int HunkLength, int NumHunks, int AutoExtendNumItems);

 

Return to Contents

extern int MemPool_Extend(MemPool* Pool, int NumHunks);

 

Return to Contents

extern void MemPool_Destroy(MemPool** pPool);

 

Return to Contents

extern void MemPool_Reset(MemPool* Pool);

 

Return to Contents

extern void * MemPool_GetHunk(MemPool* Pool);

 

Return to Contents

extern int MemPool_FreeHunk(MemPool* Pool, void * Hunk);

 

 

Return to Contents

extern int MemPool_IsValid(MemPool* Pool);

Note: only available if: #ifdef _DEBUG

 

Return to Contents