Elsevier Science Home
Computer Physics Communications Program Library
Full text online from Science Direct
Programs in Physics & Physical Chemistry
CPC Home

[Licence| Download | New Version Template] aabk_v1_0.gz(9 Kbytes)
Manuscript Title: FORMAL: a Fortran memory allocation system.
Authors: K. Dobes
Program title: FORMAL
Catalogue identifier: AABK_v1_0
Distribution format: gz
Journal reference: Comput. Phys. Commun. 36(1985)147
Programming language: Fortran.
Computer: IBM 370/135.
Operating system: IBM OS/VS1, IBM OS/MVT.
RAM: 44K words
Word size: 8
Keywords: General purpose, Utility, Fortran programming, Program transportability, Machine-independence, Dynamic memory Management.
Classification: 4.14.

Nature of problem:
The amount of working space required by many computer programs varies according to the 'characteristic size' of the physical problem being solved. To avoid all the necessary adjustments of the array declaration statements when the 'size' of the program is changed or the program code is transferred to other installation, the concept of a single working space is adopted. Efficient utilization of such a pre- allocated common working space must be ensured by appropriate 'dynamic space allocation facilities'. If consistently used, a properly designed 'space scheduler' based on the memory management functions provided by the FORMAL system may considerably improve flexibility and portability of a large class of Fortran programs.

Solution method:
Instead of a number of separately declared vectors or multidimensional arrays within the program, a single working space of a blank COMMON area is dynamically divided by the FORMAL system into partitions which are temporarily or permanently assigned to individual program tasks. Thus the whole working regime of the program may be effectively controlled by only one parameter - the size of the COMMON block. The user is supplied with a set of Standard Fortran subroutines which support the basic space management functions, i.e. optimization of memory utilization by allocating, dropping and garbage-collecting the working space. " Dynamic allocations " of all the standard types of variables are possible. The system automatically reflects the changes in variable lengths when the programs are transferred between different computers. However, the following FORTRAN features that practically do not restrict the use of FORMAL are essential:
a) the lengths of any of the REAL, COMPLEX, DOUBLE PRECISION or LOGICAL variables used (measured either in number of bytes, storage locations or words) are multiples of the INTEGER variable size;
b) purely formal out-of-bound references in array indexing are not checked or recognised during the program execution.

Dynamic allocation of a large number (several tens) of very short arrays (only a few variables long) is uneconomical for both memory efficiency and code length.

Unusual features:
The highest portability and a well-balanced trade-off between the system overhead and its generality, flexibility, reliability and efficiency for a large number of practical applications were the main objectives of the FORMAL design.

Running time:
In most practical cases, the time spent in the system subroutines is negligible compared with that required by the problem program. The test runs on IBM 370/135 take about 1 sec of CPU time.