Public Types | |
enum | { DefaultAccelBlockSizeLimit = 2048 } |
Public Member Functions | |
virtual void * | Alloc (size_t size)=0 |
virtual void * | Realloc (void *ptr, size_t size)=0 |
virtual void | Free (void *ptr)=0 |
virtual int | DebugCheckConsistency ()=0 |
Static Public Member Functions | |
static PROUD_API CFastHeap * | New (size_t AccelBlockSizeLimit=DefaultAccelBlockSizeLimit, const CFastHeapSettings &settings=CFastHeapSettings()) |
static void | AssureValidBlock (void *block) |
Though this allocation class allocates heap alloc with high speed but there are some restrictions.
Usage
Strength
Weakness
|
pure virtual |
Allocate the memory. The allocated memory may be adjusted by Realloc or Free.
size | Size of the memory to be allocated. |
|
static |
If block is not created by fast heap then it will either produce an error window or cause a crash.
|
pure virtual |
Clear the memory that was allocated.
ptr | Pointer of the memory that was allocated. |
|
static |
Creates CFastHeap object
AccelBlockSizeLimit | Whenever allocating memory block bigger than this value, this allocates a usual memory block that does not follow lookaside allocator. Bigger this value becomes, occupies more memory but also increased chance of high speed heap allocation probability. (But if it is too bug then it lowers performance due to page fault cost.) |
pHeap | In order to let this Fast Heap use other Heap that is not previously created by ProudNet, CMemoryHeap object pointer must be entered in here. But, this class does not automatically remove CMemoryHeap. If NULL is entered in here then uses previously created Heap by ProudNet. |
safeMode | Please refer CLookasideAllocator.New() |
debugSafetyCheckCritSec | for debugging use. Only valid when safeMode=false Whenever access to this fast heap, must check if critical section pointed by debugSafetyCheckCritSec is in its locked status by current thread, if not locked then this alarms that error occurs. |
|
pure virtual |
Reallocate the memory. As reallocated memory may have its position switched, you must refer the returned pointer value.
ptr | Memory pointer to be reallocated. |
size | Memory size to be reallocated. |