LaGriT uses dynamic memory allocation. Memory is referenced by a two part name, block name and partition name. It is allocated in integer or real blocks(real is implemented as real *8). Each memory block is preceeded by a header and terminated by a trailer. The memory manager always returns the pointer to the data section of the memory block. Length is specified in words. Type indicates if the words are integer or real. Different platforms will have different values for integer and real word lengths. These machine dependent values are collected in the include file machine.h.
The following parameter names are used by the memory management routines:
blk block name of memory block prt partition name of memory block iadr pointer to memory block (data section) length number of words in block or to be allocated itype 1 for integer, 2 for real(real *8) , 3 for character icscode return code, 0 for no errors increment numbers of words to use as increment to size of memory block need required size of memory block extra extra amount to add to size of memory block when increasing its size ———– ———————————————————————-
In the following list underlined parameters are required input parameters.
Allocate a block of memory:
Release a block of memory:
Release a partition of memory – all blocks belonging to this partition will be released:
Increment a block of memory by increment:
Find pointer (idar) and length (length) to a block of memory:
Return type (itype) of a block of memory:
Return number of words (length) in a block of memory given the address of the block:
Return number of words (length) in a block of memory given the name of the block:
Return name (blk, prt) of a block of memory:
Return address (iadr) of a block of memory:
mmgetpr (blk, prt,iadr,icscode)
Print a dump of allocated memory. This is useful for debugging purposes; the dump is listed by increasing pointer address:
Verify memory integrity. Print debug information if the memory block headers or trailers have been overwritten.
Find a block of memory, increase it if shorter than length, or allocate it if it doesn’t exist;
Change the length of a block of memory to length.
Change the name of a partition to prt1 from prt2
Get the address of the requested block and change the size of the storage to need+extra if need > length. Always return in length the new length of the block. If length is 0 on entry, allocate a new block.