PPL Logo

libs/ck-libs/metis/GKlib/memory.c File Reference

This file contains various allocation routines. More...

Go to the source code of this file.

Functions

 GK_MKALLOC (gk_c, char)
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 ()

Variables

static CMK_THREADLOCAL gk_mcore_tgkmcore = NULL


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 10783 2011-09-21 23:19:56Z karypis $ 
This file in metis was modified by Kavitha Chandrasekar at UIUC

Definition in file memory.c.


Function Documentation

GK_MKALLOC ( gk_c  ,
char   
)

Define the set of memory allocation routines for each data type

Definition at line 27 of file memory.c.

References gk_free(), gk_idx_t, and gk_malloc().

Here is the call graph for this function:

void gk_FreeMatrix ( void ***  r_matrix,
size_t  ndim1,
size_t  ndim2 
)

This function frees a two-dimensional matrix.

Definition at line 81 of file memory.c.

References gk_free(), and gk_idx_t.

Here is the call graph for this function:

int gk_malloc_init (  ) 

This function initializes tracking of heap allocations.

Definition at line 101 of file memory.c.

References gk_gkmcoreCreate(), gk_gkmcorePush(), and gkmcore.

Referenced by main(), METIS_MeshToDual(), METIS_MeshToNodal(), METIS_NodeND(), METIS_PartGraphKway(), METIS_PartGraphRecursive(), METIS_PartMeshDual(), and METIS_PartMeshNodal().

Here is the call graph for this function:

Here is the caller graph for this function:

void gk_malloc_cleanup ( int  showstats  ) 

This function frees the memory that has been allocated since the last call to gk_malloc_init().

Definition at line 120 of file memory.c.

References gk_mcore_t::cmop, gk_gkmcoreDestroy(), gk_gkmcorePop(), and gkmcore.

Referenced by main(), METIS_MeshToDual(), METIS_MeshToNodal(), METIS_NodeND(), METIS_PartGraphKway(), METIS_PartGraphRecursive(), METIS_PartMeshDual(), and METIS_PartMeshNodal().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Definition at line 142 of file memory.c.

References gk_errexit(), gk_GetCurMemoryUsed(), gk_GetMaxMemoryUsed(), gk_gkmcoreAdd(), gkmcore, and malloc().

Referenced by Allocate2WayNodePartitionMemory(), AllocateKWayPartitionMemory(), AllocateRefinementWorkSpace(), CreateGraph(), CreateMesh(), FixGraph(), gk_csr_Create(), gk_csr_Split(), gk_getline(), gk_graph_Create(), gk_graph_Split(), gk_i2cc2i_create_common(), gk_mcoreCreate(), gk_mcoreMalloc(), GK_MKALLOC(), gk_readfile(), gk_readpdbfile(), gk_seq_ReadGKMODPSSM(), gk_strdup(), gk_strtokenize(), GrowBisectionNode(), GrowBisectionNode2(), HTable_Create(), main(), parse_cmdline(), SetupCtrl(), and SplitGraphOrderCC().

Here is the call graph for this function:

Here is the caller graph for this function:

void* gk_realloc ( void *  oldptr,
size_t  nbytes,
char *  msg 
)

Definition at line 174 of file memory.c.

References gk_errexit(), gk_GetCurMemoryUsed(), gk_GetMaxMemoryUsed(), gk_gkmcoreAdd(), gk_gkmcoreDel(), gkmcore, and realloc().

Referenced by cnbrpoolGetNext(), gk_getline(), gk_strstr_replace(), and vnbrpoolGetNext().

Here is the call graph for this function:

Here is the caller graph for this function:

void gk_free ( void **  ptr1,
  ... 
)

Definition at line 204 of file memory.c.

References free(), gk_gkmcoreDel(), and gkmcore.

Referenced by CheckGraph(), CompressGraph(), ComputeElementBalance(), ComputeFillIn(), ComputeMaxCut(), ComputePartitionBalance(), ComputePartitionInfo(), ComputePartitionInfoBipartite(), ComputeVolume(), CreateGraphDual(), CreateGraphNodal(), FindPartitionInducedComponents(), FindSepInducedComponents(), FixGraph(), FreeCtrl(), FreeGraph(), FreeMesh(), FreeRData(), FreeWorkSpace(), gk_csr_CompactColumns(), gk_csr_ComputeSquaredNorms(), gk_csr_ComputeSums(), gk_csr_CreateIndex(), gk_csr_Free(), gk_csr_FreeContents(), gk_csr_GetSimilarRows(), gk_csr_LowFilter(), gk_csr_Prune(), gk_csr_Read(), gk_csr_Scale(), gk_csr_SortIndices(), gk_csr_TopKPlusFilter(), gk_dreadfilebin(), gk_find_frequent_itemsets(), gk_freadfilebin(), gk_FreeMatrix(), gk_freepdbf(), gk_freetokenslist(), gk_graph_ComputeBestFOrdering(), gk_graph_ComputeBestFOrdering0(), gk_graph_ComputeBFSOrdering(), gk_graph_FindComponents(), gk_graph_Free(), gk_graph_FreeContents(), gk_graph_Prune(), gk_graph_Read(), gk_graph_Reorder(), gk_graph_SingleSourceShortestPaths(), gk_graph_SortAdjacencies(), gk_i32readfile(), gk_i32readfilebin(), gk_i64readfile(), gk_i64readfilebin(), gk_mcoreDestroy(), gk_mcorePop(), GK_MKALLOC(), gk_readfile(), gk_rw_PageRank(), gk_seq_free(), gk_seq_ReadGKMODPSSM(), gk_strstr_replace(), HTable_Destroy(), HTable_Resize(), InduceRowPartFromColumnPart(), InitKWayPartitioning(), IsConnectedSubdomain(), main(), METIS_NodeND(), METIS_NodeNDP(), METIS_PartMeshDual(), MinCover(), MinCover_Decompose(), MlevelNestedDissectionCC(), PrintSubDomainGraph(), PruneGraph(), ReadGraph(), ReadMesh(), ReadTPwgts(), reorder_centroid(), smbfct(), and test_strstr_replace().

Here is the call graph for this function:

size_t gk_GetCurMemoryUsed (  ) 

Definition at line 235 of file memory.c.

References gk_mcore_t::cur_hallocs, and gkmcore.

Referenced by gk_malloc(), gk_realloc(), main(), and print_final_info().

Here is the caller graph for this function:

size_t gk_GetMaxMemoryUsed (  ) 

Definition at line 248 of file memory.c.

References gkmcore, and gk_mcore_t::max_hallocs.

Referenced by gk_malloc(), gk_realloc(), main(), and print_final_info().

Here is the caller graph for this function:


Variable Documentation

CMK_THREADLOCAL gk_mcore_t* gkmcore = NULL [static]


Generated on Mon Sep 21 08:09:05 2020 for Charm++ by  doxygen 1.5.5