|
GADGET-4
|
#include <mymalloc.h>
Inherits setcomm.
Public Member Functions | |
| memory () | |
| void | mymalloc_init (int maxmemsize, enum restart_options restartflag) |
| Initialize memory manager. More... | |
| 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. More... | |
| 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. More... | |
| void | myfree_movable_fullinfo (void *p, const char *func, const char *file, int line, int movable_flag) |
| Deallocate a movable memory block. More... | |
| void * | myfree_query_last_block (void) |
| size_t | roundup_to_multiple_of_cacheline_size (size_t n) |
| void | report_detailed_memory_usage_of_largest_task (void) |
| Output memory usage for the task with the greatest amount of memory allocated. More... | |
| void | check_maxmemsize_setting (int maxmemsize) |
| double | getAllocatedBytesInMB (void) |
| template<typename T > | |
| T * | alloc (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
| template<typename T > | |
| T * | alloc_movable (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
| template<typename T > | |
| T * | realloc (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
| template<typename T > | |
| T * | realloc_movable (T *&ptr, const char *varname, size_t n, const char *func, const char *file, int linenr) |
| void | dealloc (void *ptr, const char *func, const char *file, int linenr) |
| void | dealloc_movable (void *ptr, const char *func, const char *file, int linenr) |
| void | dump_memory_table (void) |
| Dump the buffer where the memory information is stored to the standard output. More... | |
Public Member Functions inherited from setcomm | |
| setcomm (MPI_Comm Comm) | |
| setcomm (const char *str) | |
| void | initcomm (MPI_Comm Comm) |
| void | mpi_printf (const char *fmt,...) |
| void | determine_compute_nodes (void) |
Public Attributes | |
| size_t | AllocatedBytes |
| size_t | FreeBytes |
| char * | Base |
Public Attributes inherited from setcomm | |
| MPI_Comm | Communicator |
| int | NTask |
| int | ThisTask |
| int | PTask |
| int | ThisNode |
| int | NumNodes = 0 |
| int | TasksInThisNode |
| int | RankInThisNode |
| int | MinTasksPerNode |
| int | MaxTasksPerNode |
| long long | MemoryOnNode |
| long long | SharedMemoryOnNode |
Definition at line 42 of file mymalloc.h.
|
inline |
Definition at line 45 of file mymalloc.h.
|
inline |
Definition at line 71 of file mymalloc.h.
|
inline |
Definition at line 77 of file mymalloc.h.
| void check_maxmemsize_setting | ( | int | maxmemsize | ) |
Definition at line 593 of file mymalloc.cc.
|
inline |
Definition at line 94 of file mymalloc.h.
|
inline |
Definition at line 96 of file mymalloc.h.
| void dump_memory_table | ( | void | ) |
Dump the buffer where the memory information is stored to the standard output.
Definition at line 264 of file mymalloc.cc.
|
inline |
Definition at line 68 of file mymalloc.h.
| void myfree_movable_fullinfo | ( | void * | p, |
| const char * | func, | ||
| const char * | file, | ||
| int | line, | ||
| int | movable_flag | ||
| ) |
Deallocate a movable memory block.
For this operation to be successful all the blocks allocated after the block that has to be freed must be of movable type.
| p | pointer to the memory block to be deallocated |
| func | name of function that has called the deallocation routine (usually given by the FUNCTION macro) |
| file | file where the function that has called the deallocation routine resides (usually given by the FILE macro) |
| line | line number of file where the deallocation routine was called (usually given by the LINE macro) |
Definition at line 399 of file mymalloc.cc.
| void * myfree_query_last_block | ( | void | ) |
Definition at line 382 of file mymalloc.cc.
| void mymalloc_init | ( | int | maxmemsize, |
| enum restart_options | restartflag | ||
| ) |
Initialize memory manager.
This function initializes the memory manager. In particular, it sets the global variables of the module to their initial value and allocates the memory for the stack.
Definition at line 54 of file mymalloc.cc.
| 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 * | callorigin | ||
| ) |
Allocate a movable memory block and store the relative information.
| ptr | pointer to the initial memory address of the block |
| varname | name of the variable to be stored in the allocated block |
| n | size of the memory block in bytes |
| func | name of function that has called the allocation routine (usually given by the FUNCTION macro) |
| file | file where the function that has called the allocation routine resides (usually given by the FILE macro) |
| line | line number of file where the allocation routine was called (usually given by the LINE macro) |
Definition at line 311 of file mymalloc.cc.
| 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.
For this operation to be successful all the blocks allocated after the block that has to be reallocated must be of movable type.
| p | pointer to the existing memory block to be reallocated |
| n | the new size of the memory block in bytes |
| func | name of function that has called the reallocation routine (usually given by the FUNCTION macro) |
| file | file where the function that has called the reallocation routine resides (usually given by the FILE macro) |
| line | line number of file where the reallocation routine was called (usually given by the LINE macro) |
Definition at line 500 of file mymalloc.cc.
|
inline |
Definition at line 83 of file mymalloc.h.
|
inline |
Definition at line 89 of file mymalloc.h.
| void report_detailed_memory_usage_of_largest_task | ( | void | ) |
Output memory usage for the task with the greatest amount of memory allocated.
Definition at line 220 of file mymalloc.cc.
| size_t roundup_to_multiple_of_cacheline_size | ( | size_t | n | ) |
Definition at line 374 of file mymalloc.cc.
| size_t AllocatedBytes |
Definition at line 47 of file mymalloc.h.
| char* Base |
Base pointer (initial memory address) of the stack.
Definition at line 49 of file mymalloc.h.
| size_t FreeBytes |
Definition at line 48 of file mymalloc.h.