C Everything
This is a C repository containing a curated set of generic data structures and algorithm.
|
Contains decalration of structures for maintaing all mem alloc and frees. More...
Go to the source code of this file.
Data Structures | |
struct | memory_record |
struct | mem_mamnager |
Macros | |
#define | get_mem(nmemb, size) tag_alloc(nmemb, size, __FILE__, __LINE__) |
#define | free_mem(mem_addr) untag_alloc(mem_addr, __FILE__, __LINE__) |
#define | FREE_MEM untag_alloc |
Typedefs | |
typedef struct memory_record | t_mem_record |
typedef struct mem_mamnager | t_mem_manager |
Functions | |
void | mem_init (void) |
Initailize memory module More... | |
void | mem_finit (void) |
Close memory module by checking and destroying if any tagged memory More... | |
void * | tag_alloc (size_t nmemb, size_t size, char *file, int line) |
allocate memory and store in mem list (tagging) More... | |
void | untag_alloc (void *mem_addr, char *file, int line) |
deallocate memory and remove from mem list (untagging) More... | |
void | mem_alloc_report (void) |
print report of all the assigned memory More... | |
Contains decalration of structures for maintaing all mem alloc and frees.
Definition in file memory_manager.h.
#define free_mem | ( | mem_addr | ) | untag_alloc(mem_addr, __FILE__, __LINE__) |
Definition at line 9 of file memory_manager.h.
#define FREE_MEM untag_alloc |
Definition at line 10 of file memory_manager.h.
#define get_mem | ( | nmemb, | |
size | |||
) | tag_alloc(nmemb, size, __FILE__, __LINE__) |
Definition at line 8 of file memory_manager.h.
typedef struct mem_mamnager t_mem_manager |
typedef struct memory_record t_mem_record |
void mem_alloc_report | ( | void | ) |
print report of all the assigned memory
Definition at line 110 of file memory_manager.c.
void mem_finit | ( | void | ) |
Close memory module by checking and destroying if any tagged memory
Definition at line 24 of file memory_manager.c.
void mem_init | ( | void | ) |
void* tag_alloc | ( | size_t | nmemb, |
size_t | size, | ||
char * | file, | ||
int | line | ||
) |
allocate memory and store in mem list (tagging)
Definition at line 44 of file memory_manager.c.
void untag_alloc | ( | void * | mem_addr, |
char * | file, | ||
int | line | ||
) |
deallocate memory and remove from mem list (untagging)
Definition at line 78 of file memory_manager.c.