![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cHeap.h>
Public Types | |
enum | FILL_TYPE { FILL_AllocStack = 0xCC , FILL_Alloc = 0xCD , FILL_Freed = 0xDD , FILL_AlignTail = 0xBD , FILL_UnusedStack = 0xFE , FILL_Prefix = 0xFD } |
Static Public Member Functions | |
static UINT64 __stdcall | get_PhysTotal () |
static UINT64 __stdcall | get_PhysAvail () |
static void __stdcall | Init (int nFlags=0) |
static bool __stdcall | Check () |
static size_t __stdcall | GetSize (const void *pData) noexcept |
static bool __stdcall | IsValidHeap (const void *pData) noexcept |
static bool | IsCorruptHeap (const void *pData) noexcept |
static bool __stdcall | IsValidInside (const void *pData, ptrdiff_t index) noexcept |
static void *__stdcall | AllocPtr (size_t nSize) |
static void * | AllocPtr (size_t nSize, const void *pDataInit) |
static void __stdcall | FreePtr (void *pData) |
static void *__stdcall | ReAllocPtr (void *pData, size_t nSize) |
Static Public Attributes | |
static const size_t | k_ALLOC_MAX = 0x1000000 |
256 * 64K = (arbitrary) largest reasonable single malloc. More... | |
static ITERATE_t | sm_nAllocs = 0 |
count total allocations (i.e. Number of calls to malloc() minus calls to free()) More... | |
Friends | |
class | cHeapTests |
A static name space for applications main heap allocation/free related functions.
Debug Heap fill bytes.
|
static |
Allocate a block of memory on the application heap. assume nothing about its current contents. uninitialized. Same footprint as C malloc() 0 size is allowed for some reason. (maybe returns NON nullptr)
|
inlinestatic |
Allocate memory then copy stuff into it.
Explicitly check the heap for consistency, validity. Assert if the memory check fails. called automatically every so often if (_CRTDBG_CHECK_ALWAYS_DF,_CRTDBG_CHECK_EVERY_16_DF,_CRTDBG_CHECK_EVERY_128_DF,etc)
|
static |
free a pointer to a block allocated on the heap. Same footprint as C free()
|
static |
get total physical memory that might be avail to this process. UINT64 same as size_t for 64bit
|
static |
|
staticnoexcept |
get the actual allocated size of a memory block in bytes.
|
static |
Initialize the heap to debug if desired.
|
inlinestaticnoexcept |
is this NOT a valid malloc() heap pointer?
is this a valid malloc() heap pointer?
Is this offset inside the valid heap block.
|
static |
allocate a different sized block but preserve existing content. Same footprint as C realloc()
|
friend |
|
static |
256 * 64K = (arbitrary) largest reasonable single malloc.
|
static |
count total allocations (i.e. Number of calls to malloc() minus calls to free())