If F_MEMORY_DEBUG is enabled, the memory debugging system will create macros that replace malloc, free and realloc and allows the system to keppt track of and report where memory is beeing allocated, how much and if the memory is beeing freed. This is very useful for finding memory leaks in large applications. The system can also over allocate memory and fill it with a magic number and can therfor detect if the application writes outside of the allocated memory. if F_EXIT_CRASH is defined, then exit(); will be replaced with a funtion that writes to NULL. This will make it trivial ti find out where an application exits using any debugger.,


void f_debug_memory_init(void (*lock)(void *mutex), void (*unlock)(void *mutex), void *mutex);

Description: Required for memory debugger to be thread safe


void *f_debug_mem_malloc(uint size, char *file, uint line);

Description: Replaces malloc and records the c file and line where it was called


void *f_debug_mem_realloc(void *pointer, uint size, char *file, uint line);

Description: Replaces realloc and records the c file and line where it was called


void f_debug_mem_free(void *buf);

Description: Replaces free and records the c file and line where it was called


void f_debug_mem_print(uint min_allocs);

Description: Prints out a list of all allocations made, their location, how much memorey each has allocated, freed, and how many allocations have been made. The min_allocs parameter can be set to avoid printing any allocations that have been made fewer times then min_allocs


void f_debug_mem_reset();

Description: f_debug_mem_reset allows you to clear all memory stored in the debugging system if you only want to record allocations after a specific point in your code


boolean f_debug_memory();

Description: f_debug_memory checks if any of the bounds of any allocation has been over written and reports where to standard out. The function returns TRUE if any error was found


void exit_crash(uint i);

Description: finction guaranteed to crash (Writes to NULL).