Fast Auxiliary Space Preconditioning  1.8.4 Feb/15/2016
memory.c File Reference

Memory allocation and deallocation subroutines. More...

#include "fasp.h"

Go to the source code of this file.

Functions

void * fasp_mem_calloc (LONGLONG size, INT type)
 1M = 1024*1024 More...
 
void * fasp_mem_realloc (void *oldmem, LONGLONG tsize)
 Reallocate, initiate, and check memory. More...
 
void fasp_mem_free (void *mem)
 Free up previous allocated memory body. More...
 
void fasp_mem_usage ()
 Show total allocated memory currently. More...
 
SHORT fasp_mem_check (void *ptr, const char *message, INT ERR)
 Check wether a point is null or not. More...
 
SHORT fasp_mem_iludata_check (ILU_data *iludata)
 Check wether a ILU_data has enough work space. More...
 
SHORT fasp_mem_dcsr_check (dCSRmat *A)
 Check wether a dCSRmat A has sucessfully allocated memory. More...
 

Variables

unsigned INT total_alloc_mem = 0
 
unsigned INT total_alloc_count = 0
 Total allocated memory amount. More...
 
const INT Million = 1048576
 Total number of allocations.
 

Detailed Description

Memory allocation and deallocation subroutines.

Definition in file memory.c.

Function Documentation

void * fasp_mem_calloc ( LONGLONG  size,
INT  type 
)

1M = 1024*1024

Allocate, initiate, and check memory

Parameters
sizeNumber of memory blocks
typeSize of memory blocks
Returns
Void pointer to the allocated memory
Author
Chensong Zhang
Date
2010/08/12

Modified by Chunsheng Feng on 12/20/2013 Modified by Chunsheng Feng on 07/23/2013 Modified by Chunsheng Feng on 07/30/2013 Modified by Chensong Zhang on 07/30/2013: print error if failed

Definition at line 60 of file memory.c.

SHORT fasp_mem_check ( void *  ptr,
const char *  message,
INT  ERR 
)

Check wether a point is null or not.

Parameters
ptrVoid pointer to be checked
messageError message to print
ERRInteger error code
Returns
FASP_SUCCESS or error code
Author
Chensong Zhang
Date
11/16/2009

Definition at line 197 of file memory.c.

SHORT fasp_mem_dcsr_check ( dCSRmat A)

Check wether a dCSRmat A has sucessfully allocated memory.

Parameters
APointer to be cheked
Returns
FASP_SUCCESS if success, else ERROR message (negative value)
Author
Xiaozhe Hu
Date
11/27/09

Definition at line 248 of file memory.c.

void fasp_mem_free ( void *  mem)

Free up previous allocated memory body.

Parameters
memPointer to the memory body need to be freed
Returns
NULL pointer
Author
Chensong Zhang
Date
2010/12/24

Definition at line 150 of file memory.c.

SHORT fasp_mem_iludata_check ( ILU_data iludata)

Check wether a ILU_data has enough work space.

Parameters
iludataPointer to be cheked
Returns
FASP_SUCCESS if success, else ERROR (negative value)
Author
Xiaozhe Hu, Chensong Zhang
Date
11/27/09

Definition at line 222 of file memory.c.

void * fasp_mem_realloc ( void *  oldmem,
LONGLONG  type 
)

Reallocate, initiate, and check memory.

Parameters
oldmemPointer to the existing mem block
typeSize of memory blocks
Returns
Void pointer to the reallocated memory
Author
Chensong Zhang
Date
2010/08/12

Modified by Chunsheng Feng on 07/23/2013 Modified by Chensong Zhang on 07/30/2013: print error if failed

Definition at line 110 of file memory.c.

void fasp_mem_usage ( )

Show total allocated memory currently.

Author
Chensong Zhang
Date
2010/08/12

Definition at line 175 of file memory.c.

Variable Documentation

unsigned INT total_alloc_count = 0

Total allocated memory amount.

total allocation times

Definition at line 35 of file memory.c.

unsigned INT total_alloc_mem = 0

total allocated memory

Definition at line 34 of file memory.c.