17 #define CACHELINESIZE 64
19 #define MAXBLOCKS 5000
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);
71 inline T *
alloc(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
77 inline T *
alloc_movable(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
83 inline T *
realloc(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
89 inline T *
realloc_movable(T *&ptr,
const char *varname,
size_t n,
const char *func,
const char *file,
int linenr)
104 size_t AllocatedBytesGeneric;
106 size_t HighMarkBytes;
107 size_t HighMarkBytesWithoutGeneric;
109 double OldGlobHighMarkMB;
110 double OldGlobHighMarkMBWithoutGeneric;
121 char ***BasePointers;
124 char *ParentFileName;
127 char *HighMarkTabBuf;
129 char *HighMarkTabBufWithoutGeneric;
133 int dump_memory_table_buffer(
char *p);
135 void report_memory_usage(
int rank,
char *tabbuf);
double getAllocatedBytesInMB(void)
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.
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.
T * alloc_movable(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
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.
void dealloc_movable(void *ptr, const char *func, const char *file, int linenr)
T * alloc(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
T * realloc(T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr)
void check_maxmemsize_setting(int maxmemsize)
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)