#ifdef DEBUG
	#include	<stdlib.h>
	//  In debugging mode the defines force the normal malloc and free routines
	//  to go through the debugging malloc and free, which provide for additional
	//  error checking.
	#define		malloc(size)	debug_malloc(size)
	#define		free(ptr)		debug_free(ptr)
	void* debug_malloc(size_t size);
	void debug_free (void *ptr);
	//  next routine verifies that the pointer passed to it was allocated
	//  through the debug_malloc routine and that the user has not 
	//  walked off either end of it.  Not foolproof, but better than nothing
	short memcheck_validate_pointer (void* ptr);
#else
	#define memcheck_validate_pointer(ptr)		((void)0)	
#endif

