29 const char* CompilDate,
30 const char* CompilTime,
35 void* l_tmp =
malloc(Size);
36 if (
NULL == l_tmp)
return (l_tmp);
39#pragma GCC diagnostic push
40#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
41 if (0!=
memtrack_addblock( l_tmp, Size, File,Line,CompilDate,CompilTime,Function)) {
42#pragma GCC diagnostic pop
56 const char* CompilDate,
57 const char* CompilTime,
81 const char* CompilDate,
82 const char* CompilTime,
91 File,Line,CompilDate,CompilTime,Function);
96 memset((
char*)l_tmp, 0, NMemb*Size);
107 const char* CompilDate,
108 const char* CompilTime,
131 File,Line,CompilDate,CompilTime,Function
140 File,Line,CompilDate,CompilTime,Function
145 if (
NULL == newblk)
return (newblk);
150 memcpy(newblk,(
char*)Ptr,(l_oldsize<Size?l_oldsize:Size));
155 File,Line,CompilDate,CompilTime,Function
158 return (
void*) newblk;
167 const char* CompilDate,
168 const char* CompilTime,
180 if (
NULL != l_newblk)
184 File,Line,CompilDate,CompilTime,Function
197 const char* p_Format,
200 const char *CompilDate,
201 const char *CompilTime,
const char *Function,
213 va_start (l_ap, Function);
217 l_returncode = vasprintf(p_Ptr, p_Format, l_ap);
222 if (-1 != l_returncode)
226 File,Line,CompilDate,CompilTime,Function
void * dbg_malloc(const size_t Size, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function)
Malloc compatible standard allocation.
void * dbg_calloc(const size_t NMemb, const size_t Size, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function)
Allocate a table of item from the size of each and number.
void * dbg_realloc(void *Ptr, const size_t Size, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function)
Resize an already allocated and tracked block.
int dbg_asprintf(char **p_Ptr, const char *p_Format, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function,...)
Build a formatted string with allocation.
void dbg_free(void *Ptr, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function)
Free compatible standard memory release.
char * dbg_strdup(const char *Ptr, const char *File, const int Line, const char *CompilDate, const char *CompilTime, const char *Function)
String duplication with allocation.
Memory leak tracker header.
#define malloc(size)
Same syntaxt and same behavior than regular malloc function, with memory leaks tracking.
#define strdup(chaine)
Same syntaxt and same behavior than regular strdup function, with memory leaks tracking.
#define free(ptr)
Same syntaxt and same behavior than regular free function, with memory leaks tracking.
size_t(* memtrack_getblocksize)(const void *p_Ptr)
Functor to get size of a specific memory block.
unsigned int(* memtrack_delblock)(const void *p_Ptr, const char *p_File, const int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function)
Functor to unregister an allocated memory block metadata.
unsigned int(* memtrack_addblock)(const void *p_Ptr, const size_t p_Size, const char *p_File, const int p_Line, const char *p_CompilDate, const char *p_CompilTime, const char *p_Function)
Functor to register an allocated memory block metadata.