Nilorea Library

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Macros Groups
Functions
n_debug_mem.c File Reference
`#include "n_debug_mem.h"`
Include dependency graph for n_debug_mem.c:

Go to the source code of this file.

## Functions

int | init_debug_mem ()
| initialize debug tables More...
DEBUG_MEM_ITEM * | new_db_mem_item (void *ptr, size_t size, int line, char *file, char *func)
| allocate a new item in the debug table More...
void | delete_db_mem_item (void *ptr)
void * | db_mem_alloc (size_t size, int line, char *file, const char *func)
| allocate a new pointer with size and also put it in the debug table More...
void * | db_malloc (size_t size)
| return a new allocated element More...
void | db_mem_free (void *ptr)
| Free a pointer and also remove it from debug table. More...
int | db_mem_dump_leaked (char *file)
| Dump the current debug memory table. More...

## Detailed Description

Helpers for debugging memory

Author
  Castagnier Mickaël

Date
  2014-10-10

Definition in file n_debug_mem.c.

## Function Documentation

void * db_malloc | ( | size_t | size | ) |

return a new allocated element

Parameters

  size | the size of the element

Returns
  Allocated delement or NULL

Definition at line 126 of file n_debug_mem.c.

Here is the call graph for this function:

void * db_mem_alloc | ( | size_t | size,
|  | int | line,
|  | char * | file,
|  | const char * | func
| ) |  |

allocate a new pointer with size and also put it in the debug table

Parameters

  size | the size of the allocated data
  line | line of the allocation
  file | file of the allocation
  func | function where the allocation was made

Returns
  A new item or NULL

Definition at line 96 of file n_debug_mem.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int db_mem_dump_leaked | ( | char * | file | ) |

Dump the current debug memory table.

Parameters

  file | The name of the logfile

Returns
  TRUE or FALSE

Definition at line 163 of file n_debug_mem.c.

Here is the call graph for this function:

void * db_mem_free | ( | void * | ptr | ) |

Free a pointer and also remove it from debug table.

Parameters

  ptr | Pointer to free

Definition at line 137 of file n_debug_mem.c.

Here is the call graph for this function:

void delete_db_mem_item | ( | void * | ptr | ) |

Definition at line 75 of file n_debug_mem.c.

Here is the caller graph for this function:

int init_debug_mem | ( |  | ) |

initialize debug tables

Returns
  TRUE or FALSE

Definition at line 17 of file n_debug_mem.c.

Here is the call graph for this function:

DEBUG_MEM_ITEM * new_db_mem_item | ( | void * | ptr,
|  | size_t | size,
|  | int | line,
|  | char * | file,
|  | char * | func
| ) |  |

allocate a new item in the debug table

Parameters

  ptr | Pointer address to save
  size | the size of the allocated data
  line | line of the allocation
  file | file of the allocation
  func | function where the allocation was made

Returns
  A new item or NULL

Definition at line 50 of file n_debug_mem.c.

Here is the caller graph for this function: