hp2FEM  0.1
Functions
src/metis-5.0/GKlib/memory.c File Reference

This file contains various allocation routines. More...

#include <GKlib.h>
Include dependency graph for memory.c:

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 ()

Detailed Description

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.

Date:
Started 4/3/2007
Author:
George
Version:
$Id: memory.c 10561 2011-07-13 13:19:54Z karypis $ 

Function Documentation

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.

 All Classes Files Functions Variables Typedefs Friends Defines