1.2.2
CCC
 
memory.cpp File Reference
#include "geoslib_old_f.h"
#include "Basic/String.hpp"
#include "Basic/Timer.hpp"
#include <string.h>

Functions

void time_start (void)
 
void time_reset (void)
 
void time_chunk_add (const char *call_name)
 
void time_report (void)
 
void memory_leak_reset (void)
 
void memory_leak_report (void)
 
void mem_debug_set (int flag)
 
void memory_leak_set (int flag)
 
void memory_status (const char *title)
 
char * mem_free_ (const char *call_file, unsigned int call_line, char *tab)
 
char * mem_alloc_ (const char *call_file, unsigned int call_line, int size, int flag_fatal)
 
char * mem_copy_ (const char *call_file, unsigned int call_line, char *tabin, int size, int flag_fatal)
 
char * mem_calloc_ (const char *call_file, unsigned int call_line, int size, int size_elem, int flag_fatal)
 
char * mem_realloc_ (const char *call_file, unsigned int call_line, char *tab, int size, int flag_fatal)
 
double ** mem_tab_free (double **tab, int nvar)
 
double ** mem_tab_alloc (int nvar, int size, int flag_fatal)
 

Function Documentation

char* mem_alloc_ ( const char *  call_file,
unsigned int  call_line,
int  size,
int  flag_fatal 
)

Core allocation routine

Returns
Pointer to the array to be allocated
Parameters
[in]call_fileName of the calling file
[in]call_lineLine in the calling file
[in]sizeNumber of bytes
[in]flag_fatalError status (1 = the program stops)
char* mem_calloc_ ( const char *  call_file,
unsigned int  call_line,
int  size,
int  size_elem,
int  flag_fatal 
)

Core allocation routine

Returns
Pointer to the array to be allocated
Parameters
[in]call_fileName of the calling file
[in]call_lineLine in the calling file
[in]sizeNumber of elements
[in]size_elemNumber of bytes per element
[in]flag_fatalError status (1 = the program stops)
char* mem_copy_ ( const char *  call_file,
unsigned int  call_line,
char *  tabin,
int  size,
int  flag_fatal 
)

Core routine for allocating and copying

Returns
Pointer to the newly allocated (and copied) array
Parameters
[in]call_fileName of the calling file
[in]call_lineLine in the calling file
[in]tabinArray to be copied
[in]sizeNumber of bytes
[in]flag_fatalError status (1 = the program stops)
void mem_debug_set ( int  flag)

Set the status of the memory

Parameters
[in]flagActiviation flag
char* mem_free_ ( const char *  call_file,
unsigned int  call_line,
char *  tab 
)

Core deallocation

Returns
Pointer to the freed array
Parameters
[in]call_fileName of the calling file
[in]call_lineLine in the calling file
[in]tabArray to be freed
char* mem_realloc_ ( const char *  call_file,
unsigned int  call_line,
char *  tab,
int  size,
int  flag_fatal 
)

Core re-allocation routine

Returns
Pointer to the array to be re_allocated
Parameters
[in]call_fileName of the calling file
[in]call_lineLine in the calling file
[in]tabArray to be reallocated
[in]sizeNew number of bytes
[in]flag_fatalError status (1 = the program stops)
double** mem_tab_alloc ( int  nvar,
int  size,
int  flag_fatal 
)

Core allocation of an array of double

Returns
Pointer to the array of pointers to be allocated
Parameters
[in]nvarnumber of elements in the array
[in]sizenumber of double values
[in]flag_fatalerror status (1 = the program stops)
double** mem_tab_free ( double **  tab,
int  nvar 
)

Core deallocation of an array of pointers

Returns
Pointer to the freed array
Parameters
[in]tabarray of pointers to be freed
[in]nvarNumber of elements in the array
void memory_leak_report ( void  )

Report Memory Leak

void memory_leak_reset ( void  )

Reset the Memory Leak processing structure

void memory_leak_set ( int  flag)

Set the memory leak mechanism

Parameters
[in]flagActivation flag
void memory_status ( const char *  title)

Print the status of the memory

Parameters
[in]titleTitle printed when checking memory
void time_chunk_add ( const char *  call_name)

Initialize a Time Chunk

Parameters
[in]call_nameName of the Chunk
void time_report ( void  )

Report the Time Stats

void time_reset ( void  )

Reset the Time

void time_start ( void  )

Initialize the Timer