libdebug 1.0.0
Debugging helper library with Memory leak detection
memtrack.h
Go to the documentation of this file.
1
19#ifndef __MEMTRACK_H__
20#define __MEMTRACK_H__
21
22#ifdef HAVE_CONFIG_H
23# include "config.h"
24#endif
25
26#include <stdlib.h> /* size_t */
27#include <stdint.h> /* uint64_t */
28
33typedef struct MemBlock {
34 struct MemBlock *Prev;
35 struct MemBlock *Next;
36 void *Ptr;
37 size_t Size;
38 char *File;
39 int Line;
40 char *CompilDate;
41 char *CompilTime;
42 char *Function;
44
45extern unsigned int (*memtrack_addblock) (const void *p_Ptr,
46 const size_t p_Size,
47 const char *p_File,
48 const int p_Line,
49 const char *p_CompilDate,
50 const char *p_CompilTime,
51 const char *p_Function);
52extern unsigned int (*memtrack_delblock) (const void *p_Ptr,
53 const char *p_File,
54 const int p_Line,
55 const char *p_CompilDate,
56 const char *p_CompilTime,
57 const char *p_Function);
58extern uint64_t (*memtrack_dumpblocks) ();
59extern uint64_t (*memtrack_getallocatedblocks) ();
60extern uint64_t (*memtrack_getallocatedRAM) ();
61extern size_t(*memtrack_getblocksize) (const void *p_Ptr);
62
63#endif /* __MEMTRACK_H__ */
64
65/* vim: set tw=80: */
size_t(* memtrack_getblocksize)(const void *p_Ptr)
Functor to get size of a specific memory block.
Definition: memtrack.c:689
uint64_t(* memtrack_getallocatedblocks)()
Functor to get the number of allocated blocks.
Definition: memtrack.c:656
struct MemBlock TMemBlock
Memory block metadata list item.
uint64_t(* memtrack_getallocatedRAM)()
Functor to get the total RAM size allocated.
Definition: memtrack.c:670
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.
Definition: memtrack.c:621
uint64_t(* memtrack_dumpblocks)()
Functor to list allocated memory blocks metadata.
Definition: memtrack.c:642
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.
Definition: memtrack.c:584
Memory block metadata list item.
Definition: memtrack.h:33
size_t Size
Allocated memory block size.
Definition: memtrack.h:37
struct MemBlock * Prev
Previous item pointer.
Definition: memtrack.h:34
struct MemBlock * Next
Next item pointer.
Definition: memtrack.h:35
char * CompilDate
Source file compilation date.
Definition: memtrack.h:40
char * CompilTime
Source file compilation time.
Definition: memtrack.h:41
char * File
Source file which asked the allocation.
Definition: memtrack.h:38
char * Function
Fonction name which asked the allocation.
Definition: memtrack.h:42
void * Ptr
Allocated memory block pointer.
Definition: memtrack.h:36
int Line
Source line number ch asked the allocation.
Definition: memtrack.h:39