83#ifdef HLHDF_MEMORY_DEBUG
87#define HLHDF_MALLOC(sz) hlhdf_alloc_malloc(__FILE__, __LINE__, sz)
92#define HLHDF_CALLOC(npts,sz) hlhdf_alloc_calloc(__FILE__, __LINE__, npts, sz)
97#define HLHDF_REALLOC(ptr, sz) hlhdf_alloc_realloc(__FILE__, __LINE__, ptr, sz)
102#define HLHDF_STRDUP(x) hlhdf_alloc_strdup(__FILE__, __LINE__, x)
107#define HLHDF_FREE(x) if (x != NULL) {hlhdf_alloc_free(__FILE__, __LINE__, x); x=NULL;}
113#define HLHDF_MALLOC(sz) malloc(sz)
118#define HLHDF_CALLOC(npts,sz) calloc(npts, sz)
123#define HLHDF_REALLOC(ptr, sz) realloc(ptr, sz)
128#define HLHDF_STRDUP(x) strdup(x)
133#define HLHDF_FREE(x) if (x != NULL) {free(x);x=NULL;}
void hlhdf_alloc_dump_heap(void)
Dumps all blocks that not has been released.
Definition hlhdf_alloc.c:301
void * hlhdf_alloc_malloc(const char *filename, int lineno, size_t sz)
Allocates memory and keeps track on if it is released, overwritten and similar.
Definition hlhdf_alloc.c:186
void * hlhdf_alloc_calloc(const char *filename, int lineno, size_t npts, size_t sz)
Same as calloc but debugged.
Definition hlhdf_alloc.c:200
void * hlhdf_alloc_realloc(const char *filename, int lineno, void *ptr, size_t sz)
Same as realloc but debugged.
Definition hlhdf_alloc.c:220
void hlhdf_alloc_print_statistics(void)
Prints the statistics for the heap.
Definition hlhdf_alloc.c:320
void hlhdf_alloc_free(const char *filename, int lineno, void *ptr)
Releases the memory.
Definition hlhdf_alloc.c:275
char * hlhdf_alloc_strdup(const char *filename, int lineno, const char *str)
Same as strdup but debugged.
Definition hlhdf_alloc.c:248