mkernel 0.0.1
Micro-kernel framework, everything as a module
memory.h File Reference

Tracks memory allocation and leaks when compiled without NDEBUG. More...

#include "memdbg.h"
Include dependency graph for memory.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define malloc(size)   dbg_malloc(size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)
 Same syntaxt and same behavior than regular malloc function, with memory leaks tracking. More...
 
#define realloc(ptr, size)   dbg_realloc(ptr,size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)
 Same syntaxt and same behavior than regular realloc function, with memory leaks tracking. More...
 
#define calloc(nmemb, size)   dbg_calloc(nmemb,size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)
 Same syntaxt and same behavior than regular calloc function, with memory leaks tracking. More...
 
#define free(ptr)   dbg_free(ptr,__FILE__,__LINE__,__DATE__,__TIME__,__func__)
 Same syntaxt and same behavior than regular free function, with memory leaks tracking. More...
 
#define strdup(chaine)   dbg_strdup(chaine,__FILE__,__LINE__,__DATE__,__TIME__,__func__)
 Same syntaxt and same behavior than regular strdup function, with memory leaks tracking. More...
 
#define asprintf(out, format, ...)   dbg_asprintf(out,format,__FILE__,__LINE__,__DATE__,__TIME__,__func__,__VA_ARGS__)
 Same syntaxt and same behavior than regular asprintf function, with memory leaks tracking. More...
 
#define memreport()   memtrack_dumpblocks()
 Prints a list of currently allocated blocks on stderr. More...
 

Detailed Description

Tracks memory allocation and leaks when compiled without NDEBUG.

Date
25/09/2006
Author
François Cerbelle (Fanfan), franc.nosp@m.ois@.nosp@m.cerbe.nosp@m.lle..nosp@m.net

Originally inspired by "L'art du code", Steve Maguire, Microsoft Press This header needs to be included after most of the standard headers, ideally the last one.

Definition in file memory.h.

Macro Definition Documentation

◆ asprintf

#define asprintf (   out,
  format,
  ... 
)    dbg_asprintf(out,format,__FILE__,__LINE__,__DATE__,__TIME__,__func__,__VA_ARGS__)

Same syntaxt and same behavior than regular asprintf function, with memory leaks tracking.

Definition at line 47 of file memory.h.

◆ calloc

#define calloc (   nmemb,
  size 
)    dbg_calloc(nmemb,size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)

Same syntaxt and same behavior than regular calloc function, with memory leaks tracking.

Definition at line 38 of file memory.h.

◆ free

#define free (   ptr)    dbg_free(ptr,__FILE__,__LINE__,__DATE__,__TIME__,__func__)

Same syntaxt and same behavior than regular free function, with memory leaks tracking.

Definition at line 41 of file memory.h.

◆ malloc

#define malloc (   size)    dbg_malloc(size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)

Same syntaxt and same behavior than regular malloc function, with memory leaks tracking.

Definition at line 32 of file memory.h.

◆ memreport

#define memreport ( )    memtrack_dumpblocks()

Prints a list of currently allocated blocks on stderr.

Definition at line 50 of file memory.h.

◆ realloc

#define realloc (   ptr,
  size 
)    dbg_realloc(ptr,size,__FILE__,__LINE__,__DATE__,__TIME__,__func__)

Same syntaxt and same behavior than regular realloc function, with memory leaks tracking.

Definition at line 35 of file memory.h.

◆ strdup

#define strdup (   chaine)    dbg_strdup(chaine,__FILE__,__LINE__,__DATE__,__TIME__,__func__)

Same syntaxt and same behavior than regular strdup function, with memory leaks tracking.

Definition at line 44 of file memory.h.