KMemoryReusePool Class Reference
#include
<kmemory.h>
List of all members.
Detailed Description
A pool of memory blocks of arbitrary size.
Definition at line 164 of file kmemory.h.
|
Public Member Functions
|
|
KMemoryReusePool
(size_t pSizeRange=1024 *128, int pStrideShift=2, int pAlignmentShift=0, size_t
pTotalAllocatedMax=0) |
virtual |
~KMemoryReusePool
() |
virtual void |
Purge () |
virtual void * |
Malloc (size_t
pSize) |
virtual void * |
Calloc (size_t
pCount, size_t pSize) |
virtual void * |
Realloc (void
*pData, size_t pSize) |
virtual void |
Free (void
*pData) |
Protected Member Functions
|
bool |
SizeFitsInPool
(size_t pSize) const |
bool |
PoolIsFull ()
const |
kUChar |
ComputeAlignmentOffset
(void *pBuffer) |
void * |
AssignHeaderAndReturnBlock
(void *pBuffer, size_t pBufferSize) |
size_t |
GetBufferAndSize
(void *pBlock, void *&pBuffer) |
Static Protected Member Functions
|
static int |
ComputeRightShiftRemainder
(int pStrideShift) |
static size_t |
GetHeaderSize
() |
Protected Attributes
|
KMpMutex * |
mLock |
|
Critical section on our pool (maintained by
pointer only to not force a dependency on windows.h at large).
|
void ** |
mBuffer |
|
Our array of free lists, of size
mBufferSize.
|
size_t const |
mSizeRange |
|
Maximum alloc size.
|
size_t const |
mBufferSize |
|
mSizeRange >> mStrideShift.
|
int const |
mStrideShift |
|
Divider for mSizeRange.
|
int const |
mStrideRemainder |
|
A mask of the remainder of a right shift
done with mStrideShift.
|
int const |
mAlignmentShift |
|
Multiplier, to specify an alignment in
bytes.
|
size_t const |
mTotalAllocatedMax |
|
Maximum total amount of memory handed out or
managed by this pool (past this point, normal allocs are done).
|
size_t |
mTotalAllocated |
|
The total amount of memory handed out or
managed by this pool.
|
size_t |
mTotalBlocks |
|
The total number of blocks handed out or
managed by this pool.
|
Classes
|
struct |
KBlockHeader |
Constructor & Destructor Documentation
KMemoryReusePool |
( |
size_t |
pSizeRange =
1024 *128 , |
|
|
int |
pStrideShift = 2 , |
|
|
int |
pAlignmentShift =
0 , |
|
|
size_t |
pTotalAllocatedMax =
0 |
|
|
) |
|
|
[explicit] |
Member Function Documentation
virtual void Purge |
( |
|
) |
[virtual] |
virtual void* Malloc |
( |
size_t |
pSize |
) |
[virtual] |
virtual void* Calloc |
( |
size_t |
pCount, |
|
|
size_t |
pSize |
|
|
) |
|
|
[virtual] |
virtual void* Realloc |
( |
void * |
pData, |
|
|
size_t |
pSize |
|
|
) |
|
|
[virtual] |
virtual void Free |
( |
void * |
pData |
) |
[virtual] |
bool SizeFitsInPool |
( |
size_t |
pSize |
) |
const [inline, protected] |
bool PoolIsFull |
( |
|
) |
const [inline, protected] |
kUChar
ComputeAlignmentOffset |
( |
void * |
pBuffer |
) |
[protected] |
static int
ComputeRightShiftRemainder |
( |
int |
pStrideShift |
) |
[static, protected] |
void* AssignHeaderAndReturnBlock |
( |
void * |
pBuffer, |
|
|
size_t |
pBufferSize |
|
|
) |
|
|
[protected] |
size_t GetBufferAndSize |
( |
void * |
pBlock, |
|
|
void *& |
pBuffer |
|
|
) |
|
|
[protected] |
static size_t GetHeaderSize |
( |
|
) |
[static, protected] |
Member Data Documentation
KMpMutex* mLock
[protected] |
Critical section on our pool (maintained by pointer only to not
force a dependency on windows.h at large).
Definition at line 201 of file kmemory.h.
Our array of free lists, of size mBufferSize.
Definition at line 202 of file kmemory.h.
Maximum alloc size.
Definition at line 203 of file kmemory.h.
mSizeRange >> mStrideShift.
Definition at line 204 of file kmemory.h.
Divider for mSizeRange.
Definition at line 205 of file kmemory.h.
A mask of the remainder of a right shift done with
mStrideShift.
Definition at line 206 of file kmemory.h.
Multiplier, to specify an alignment in bytes.
Definition at line 207 of file kmemory.h.
Maximum total amount of memory handed out or managed by this
pool (past this point, normal allocs are done).
Definition at line 208 of file kmemory.h.
The total amount of memory handed out or managed by this
pool.
Definition at line 209 of file kmemory.h.
The total number of blocks handed out or managed by this
pool.
Definition at line 210 of file kmemory.h.
KMemoryReusePool KMemoryReusePool
KMemoryReusePool KMemoryReusePool KMemoryReusePool KMemoryReusePool
KMemoryReusePool KMemoryReusePool KMemoryReusePool
KMemoryReusePool
KMemoryReusePool KMemoryReusePool
KMemoryReusePool KMemoryReusePool KMemoryReusePool KMemoryReusePool
KMemoryReusePool KMemoryReusePool KMemoryReusePool
KMemoryReusePool