RAVE
|
Allocation routines for keeping track on memory. More...
#include "rave_alloc.h"
#include "rave_debug.h"
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
Classes | |
struct | RaveHeapEntry_t |
Keeps track on one allocation. More... | |
struct | RaveHeap_t |
A linked list where each entry corresponds to one allocation. More... | |
Typedefs | |
typedef struct RaveHeapEntry_t | RaveHeapEntry_t |
Keeps track on one allocation. | |
typedef struct RaveHeap_t | RaveHeap_t |
A linked list where each entry corresponds to one allocation. | |
Functions | |
void * | rave_alloc_malloc (const char *filename, int lineno, size_t sz) |
Allocates memory and keeps track on if it is released, overwritten and similar. | |
void * | rave_alloc_calloc (const char *filename, int lineno, size_t npts, size_t sz) |
Same as calloc but debugged. | |
void * | rave_alloc_realloc (const char *filename, int lineno, void *ptr, size_t sz) |
Same as realloc but debugged. | |
char * | rave_alloc_strdup (const char *filename, int lineno, const char *str) |
Same as strdup but debugged. | |
void | rave_alloc_free (const char *filename, int lineno, void *ptr) |
Releases the memory. | |
void | rave_alloc_dump_heap (void) |
Dumps all blocks that not has been released. | |
void | rave_alloc_print_statistics (void) |
Prints the statistics for the heap. | |
Allocation routines for keeping track on memory.
typedef struct RaveHeap_t RaveHeap_t |
A linked list where each entry corresponds to one allocation.
typedef struct RaveHeapEntry_t RaveHeapEntry_t |
Keeps track on one allocation.
void * rave_alloc_calloc | ( | const char * | filename, |
int | lineno, | ||
size_t | npts, | ||
size_t | sz ) |
Same as calloc but debugged.
[in] | filename | the name of the file the allocation occurs in |
[in] | lineno | the linenumber |
[in] | npts | number of points |
[in] | sz | the number of bytes to be allocated |
void rave_alloc_dump_heap | ( | void | ) |
Dumps all blocks that not has been released.
void rave_alloc_free | ( | const char * | filename, |
int | lineno, | ||
void * | ptr ) |
Releases the memory.
[in] | filename | the name of the file the allocation occurs in |
[in] | lineno | the linenumber |
[in] | ptr | the pointer that should be freed |
void * rave_alloc_malloc | ( | const char * | filename, |
int | lineno, | ||
size_t | sz ) |
Allocates memory and keeps track on if it is released, overwritten and similar.
[in] | filename | the name of the file the allocation occurs in |
[in] | lineno | the linenumber |
[in] | sz | the number of bytes to be allocated |
void rave_alloc_print_statistics | ( | void | ) |
Prints the statistics for the heap.
void * rave_alloc_realloc | ( | const char * | filename, |
int | lineno, | ||
void * | ptr, | ||
size_t | sz ) |
Same as realloc but debugged.
[in] | filename | the name of the file the allocation occurs in |
[in] | lineno | the linenumber |
[in] | ptr | the original pointer |
[in] | sz | the number of bytes to be allocated |
char * rave_alloc_strdup | ( | const char * | filename, |
int | lineno, | ||
const char * | str ) |
Same as strdup but debugged.
[in] | filename | the name of the file the allocation occurs in |
[in] | lineno | the linenumber |
[in] | str | the number of bytes to be allocated |