Table of Contents Author Guidelines Submit a Manuscript
Scientific Programming
Volume 13 (2005), Issue 3, Pages 189-203
http://dx.doi.org/10.1155/2005/702048

Dynamic Memory De-allocation in Fortran 95/2003 Derived Type Calculus

Damian W.I. Rouson,1 Karla Morris,2 and Xiaofeng Xu3

1US Naval Research Laboratory, 4555 Overlook Ave. SW, Washington, DC 20375, USA
2Department of Mechanical Engineering, The Graduate Center of the City University of New York, 365 Fifth Avenue, New York, NY 10016, USA
3Department of Fire Protection Engineering, University of Maryland, College Park, MD 20742, USA

Received 26 December 2005; Accepted 26 December 2005

Copyright © 2005 Hindawi Publishing Corporation. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.

Abstract

Abstract data types developed for computational science and engineering are frequently modeled after physical objects whose state variables must satisfy governing differential equations. Generalizing the associated algebraic and differential operators to operate on the abstract data types facilitates high-level program constructs that mimic standard mathematical notation. For non-trivial expressions, multiple object instantiations must occur to hold intermediate results during the expression's evaluation. When the dimension of each object's state space is not specified at compile-time, the programmer becomes responsible for dynamically allocating and de-allocating memory for each instantiation. With the advent of allocatable components in Fortran 2003 derived types, the potential exists for these intermediate results to occupy a substantial fraction of a program's footprint in memory. This issue becomes particularly acute at the highest levels of abstraction where coarse-grained data structures predominate. This paper proposes a set of rules for de-allocating memory that has been dynamically allocated for intermediate results in derived type calculus, while distinguishing that memory from more persistent objects. The new rules are applied to the design of a polymorphic time integrator for integrating evolution equations governing dynamical systems. Associated issues of efficiency and design robustness are discussed.