hp2FEM
0.1
|
This file contains various allocation routines. More...
#include <GKlib.h>
Functions | |
void | gk_AllocMatrix (void ***r_matrix, size_t elmlen, size_t ndim1, size_t ndim2) |
void | gk_FreeMatrix (void ***r_matrix, size_t ndim1, size_t ndim2) |
int | gk_malloc_init () |
void | gk_malloc_cleanup (int showstats) |
void * | gk_malloc (size_t nbytes, char *msg) |
void * | gk_realloc (void *oldptr, size_t nbytes, char *msg) |
void | gk_free (void **ptr1,...) |
size_t | gk_GetCurMemoryUsed () |
size_t | gk_GetMaxMemoryUsed () |
This file contains various allocation routines.
The allocation routines included are for 1D and 2D arrays of the most datatypes that GKlib support. Many of these routines are defined with the help of the macros in gk_memory.h. These macros can be used to define other memory allocation routines.
$Id: memory.c 10561 2011-07-13 13:19:54Z karypis $
void gk_AllocMatrix | ( | void *** | r_matrix, |
size_t | elmlen, | ||
size_t | ndim1, | ||
size_t | ndim2 | ||
) |
Define the set of memory allocation routines for each data type
This function allocates a two-dimensional matrix.
void gk_FreeMatrix | ( | void *** | r_matrix, |
size_t | ndim1, | ||
size_t | ndim2 | ||
) |
This function frees a two-dimensional matrix.
void* gk_malloc | ( | size_t | nbytes, |
char * | msg | ||
) |
This function is my wrapper around malloc that provides the following enhancements over malloc: It always allocates one byte of memory, even if 0 bytes are requested. This is to ensure that checks of returned values do not lead to NULL due to 0 bytes requested. It zeros-out the memory that is allocated. This is for a quick init of the underlying datastructures.
void gk_malloc_cleanup | ( | int | showstats | ) |
This function frees the memory that has been allocated since the last call to gk_malloc_init().
int gk_malloc_init | ( | ) |
This function initializes tracking of heap allocations.