This file contains various allocation routines. More...
#include <GKlib.h>
Go to the source code of this file.
Functions | |
void | gk_AllocMatrix (void ***r_matrix, size_t elmlen, size_t ndim1, size_t ndim2) |
void | gk_free (void **ptr1,...) |
void | gk_FreeMatrix (void ***r_matrix, size_t ndim1, size_t ndim2) |
size_t | gk_GetCurMemoryUsed () |
size_t | gk_GetMaxMemoryUsed () |
void * | gk_malloc (size_t nbytes, char *msg) |
void | gk_malloc_cleanup (int showstats) |
int | gk_malloc_init () |
void * | gk_realloc (void *oldptr, size_t nbytes, char *msg) |
Variables | |
static __thread gk_mcore_t * | gkmcore = NULL |
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 10783 2011-09-21 23:19:56Z karypis $
Definition in file memory.c.
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 | ( | ) |
void* gk_realloc | ( | void * | oldptr, |
size_t | nbytes, | ||
char * | msg | ||
) |
|
static |