Wrappers for C memory management functions with error checking
This module contains macros and functions that perform as wrappers for standard C memory management functions, malloc, realloc and free. The wrapper functions check for incorrect use realloc and free, memory overrun errors and double free errors. If, at program termination, that memory has not been properly free'd then error messages are written to stderr with the unfreed memory allocations. Logging of all memory management function calls to stderr can be turned on to aid in debugging. The wrappers can be 'turned off' at compile time for zero overhead. (../include/deds/alloc.h)
Part of the deds library.
# define MXMODULE_ALLOC
Turn on memory tracking
If this macro is defined the functions mx_malloc, mx_realloc and mx_free are made to keep track of memory allocated and warn from common memory allocation mistakes. If this symbol is not defined then mx_malloc, mx_realloc and mx_free just pass all arguments to the corresponding stdlib malloc, realloc, and free function. In this case no additional memory checking is done. (../include/deds/alloc.h)
# define mx_malloc
Replacement for stdlib malloc
This function is a wrapper for malloc(). If MXMODULE_ALLOC is defined then this function keeps track of memory and warns about possible memory allocation problems. (../include/deds/alloc.h)
# define mx_realloc
Replacement for stdlib realloc
This function is a wrapper for realloc(). If MXMODULE_ALLOC is defined then this function keeps track of memory and warns about possible memory allocation problems. (../include/deds/alloc.h)
# define mx_free
Replacement for stdlib free
This function is a wrapper for free(). If MXMODULE_ALLOC is defined then this function keeps track of memory and warns about possible memory allocation problems. (../include/deds/alloc.h)
# define MXDEBUG_ALLOCTAG(p)
Tag an allocation (debug)
This macro tags a pointer to memory with the current filename and source line. If the pointer does not exist the the current allocation list then this macro does nothing. If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then this macro compiles to nothing. (../include/deds/alloc.h)
# define MXDEBUG_ALLOCCHECK()
Check all allocations
This macro causes all allocations to be checked for over/under writing. If memory debugging is off (MXMODULE_ALLOC undefined or NDEBUG is defined) then this macro compiles to nothing. (../include/deds/alloc.h)
Generated by MXDOC 2.2 on Sun Feb 4 15:16:26 2007