17#define CACHELINESIZE 64
22#define LOC __FUNCTION__, __FILE__, __LINE__
23#define MMM(x, y) (x, #x, y, __FUNCTION__, __FILE__, __LINE__)
24#define DDD(x) (x, __FUNCTION__, __FILE__, __LINE__)
26#define mymalloc(x, y) mymalloc_movable_fullinfo(NULL, x, y, __FUNCTION__, __FILE__, __LINE__, 0, 0, NULL)
27#define mymalloc_clear(x, y) mymalloc_movable_fullinfo(NULL, x, y, __FUNCTION__, __FILE__, __LINE__, 0, 1, NULL)
28#define mymalloc_g(x, y) mymalloc_movable_fullinfo(NULL, x, y, __FUNCTION__, __FILE__, __LINE__, 0, 0, callorigin)
30#define mymalloc_movable(x, y, z) mymalloc_movable_fullinfo(x, y, z, __FUNCTION__, __FILE__, __LINE__, 1, 0, NULL)
31#define mymalloc_movable_clear(x, y, z) mymalloc_movable_fullinfo(x, y, z, __FUNCTION__, __FILE__, __LINE__, 1, 1, NULL)
32#define mymalloc_movable_g(x, y, z) mymalloc_movable_fullinfo(x, y, z, __FUNCTION__, __FILE__, __LINE__, 1, 0, callorigin)
34#define myfree(x) myfree_movable_fullinfo(x, __FUNCTION__, __FILE__, __LINE__, 0)
35#define myfree_movable(x) myfree_movable_fullinfo(x, __FUNCTION__, __FILE__, __LINE__, 1)
37#define myrealloc(x, y) myrealloc_movable_fullinfo(x, y, __FUNCTION__, __FILE__, __LINE__, 0)
38#define myrealloc_movable(x, y) myrealloc_movable_fullinfo(x, y, __FUNCTION__, __FILE__, __LINE__, 1)
40#include "../mpi_utils/setcomm.h"
54 int movable_flag,
int clear_flag,
char *originflag);
74 inline T *
alloc(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
80 inline T *
alloc_movable(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
86 inline T *
realloc(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
92 inline T *
realloc_movable(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
107 size_t AllocatedBytesGeneric;
109 size_t HighMarkBytes;
110 size_t HighMarkBytesWithoutGeneric;
112 double OldGlobHighMarkMB;
113 double OldGlobHighMarkMBWithoutGeneric;
124 char ***BasePointers;
127 char *ParentFileName;
130 char *HighMarkTabBuf;
132 char *HighMarkTabBufWithoutGeneric;
136 int dump_memory_table_buffer(
char *p);
138 void report_memory_usage(
int rank,
char *tabbuf);
double getAllocatedBytesInMB(void)
T * alloc_movable(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
void * myrealloc_movable_fullinfo(void *p, size_t n, const char *func, const char *file, int line, int movable_flag)
Reallocate an existing movable memory block.
T * realloc(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
int myMPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, void *baseptr, MPI_Win *win)
void * mymalloc_movable_fullinfo(void *ptr, const char *varname, size_t n, const char *func, const char *file, int line, int movable_flag, int clear_flag, char *originflag)
Allocate a movable memory block and store the relative information.
void myfree_movable_fullinfo(void *p, const char *func, const char *file, int line, int movable_flag)
Deallocate a movable memory block.
void * myfree_query_last_block(void)
void dump_memory_table(void)
Dump the buffer where the memory information is stored to the standard output.
void report_detailed_memory_usage_of_largest_task(void)
Output memory usage for the task with the greatest amount of memory allocated.
T * alloc(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
void dealloc_movable(void *ptr, const char *func, const char *file, int linenr)
void check_maxmemsize_setting(int maxmemsize)
int myMPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit, void *baseptr)
void mymalloc_init(int maxmemsize, enum restart_options restartflag)
Initialize memory manager.
size_t roundup_to_multiple_of_cacheline_size(size_t n)
void dealloc(void *ptr, const char *func, const char *file, int linenr)
T * realloc_movable(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)