Fast Auxiliary Space Preconditioning 2.7.7 Aug/28/2022
Loading...
Searching...
No Matches
AuxMemory.c File Reference

Memory allocation and deallocation subroutines. More...

#include "fasp.h"
#include "fasp_functs.h"

Go to the source code of this file.

Functions

void * fasp_mem_calloc (const unsigned int size, const unsigned int type)
 Allocate, initiate, and check memory. More...
 
void * fasp_mem_realloc (void *oldmem, const LONGLONG tsize)
 Reallocate, initiate, and check memory. More...
 
void fasp_mem_free (void *mem)
 Free up previous allocated memory body and set pointer to NULL. More...
 
void fasp_mem_usage (void)
 Show total allocated memory currently. More...
 
SHORT fasp_mem_iludata_check (const ILU_data *iludata)
 Check wether a ILU_data has enough work space. More...
 

Variables

const int Million = 1048576
 

Detailed Description

Memory allocation and deallocation subroutines.

Note
This file contains Level-0 (Aux) functions.

Copyright (C) 2009–Present by the FASP team. All rights reserved.

Released under the terms of the GNU Lesser General Public License 3.0 or later.

Definition in file AuxMemory.c.

Function Documentation

◆ fasp_mem_calloc()

void * fasp_mem_calloc ( const unsigned int  size,
const unsigned int  type 
)

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 Chensong Zhang on 07/30/2013: print warnings if failed

Definition at line 65 of file AuxMemory.c.

◆ fasp_mem_free()

void fasp_mem_free ( void *  mem)

Free up previous allocated memory body and set pointer to NULL.

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

Modified on 2018/01/10 by Chensong: Add output when mem is NULL

Definition at line 152 of file AuxMemory.c.

◆ fasp_mem_iludata_check()

SHORT fasp_mem_iludata_check ( const ILU_data iludata)

Check wether a ILU_data has enough work space.

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

Definition at line 203 of file AuxMemory.c.

◆ fasp_mem_realloc()

void * fasp_mem_realloc ( void *  oldmem,
const LONGLONG  tsize 
)

Reallocate, initiate, and check memory.

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

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

Definition at line 113 of file AuxMemory.c.

◆ fasp_mem_usage()

void fasp_mem_usage ( void  )

Show total allocated memory currently.

Author
Chensong Zhang
Date
2010/08/12

Definition at line 183 of file AuxMemory.c.

Variable Documentation

◆ Million

const int Million = 1048576

1M = 1024*1024

Definition at line 44 of file AuxMemory.c.