Two versions of memory allocation/deallocation are available. If compiled with MEMTRACE defined, CUnit keeps track of all system allocations & deallocations. The memory record can then be reported using CU_CREATE_MEMORY_REPORT. Otherwise, standard system memory allocation is used without tracing.
Go to the source code of this file.
Defines | |
#define | CU_CALLOC(x, y) calloc((x), (y)) |
Standard calloc() if MEMTRACE not defined. | |
#define | CU_MALLOC(x) malloc((x)) |
Standard malloc() if MEMTRACE not defined. | |
#define | CU_FREE(x) free((x)) |
Standard free() if MEMTRACE not defined. | |
#define | CU_REALLOC(x, y) realloc((x), (y)) |
Standard realloc() if MEMTRACE not defined. | |
#define | CU_CREATE_MEMORY_REPORT(x) |
No-op if MEMTRACE not defined. | |
#define | CU_DUMP_MEMORY_USAGE(x) |
No-op if MEMTRACE not defined. | |
Functions | |
void | test_cunit_deactivate_malloc (void) |
Disable memory allocation for testing purposes. | |
void | test_cunit_activate_malloc (void) |
Enable memory allocation for testing purposes. | |
unsigned int | test_cunit_get_n_memevents (void *pLocation) |
Retrieve number of memory events for a given pointer. | |
unsigned int | test_cunit_get_n_allocations (void *pLocation) |
Retrieve number of allocations for a given pointer. | |
unsigned int | test_cunit_get_n_deallocations (void *pLocation) |
Retrieve number of deallocations for a given pointer. | |
void | test_cunit_MyMem (void) |
The main internal testing function for MyMem.c. |