Abstract
Garbage collection relieves the programmer of the burden of managing dynamically allocated memory, by providing an automatic way to reclaim unneeded storage. This eliminates or lessens program errors that arise from attempts to access disposed memory, and generally leads to simpler programs. One might therefore expect that reasoning about programs in garbage collected languages would be much easier than in languages where the programmer has more explicit control over memory. But existing program logics are based on a low level view of storage that is sensitive to the presence or absence of unreachable cells, and Reynolds has pointed out that the Hoare triples derivable in these logics are even incompatible with garbage collection. We present a semantics of program logic assertions based on a view of the heap as finite, but extensible; this is for a logical language with primitives for dereferencing pointer expressions. The essential property of the semantics is that all propositions are invariant under operations of adding or removing garbage cells; in short, they are garbage insensitive. We use the assertion language to formulate notions of partial and total correctness for a small programming language, and provide logical characterizations of two natural notions of observational equivalence between programs.
Work partially supported by the EPSRC
Chapter PDF
Similar content being viewed by others
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
References
M. Benedikt, T. Reps, and M. Sagiv. A decidable logic for describing linked data structures. In ESOP’ 99: European Symposium on Programming, pages 2–19. Lecture Notes in Computer Science, Vol. 1576, S.D. Swierstra (ed.), Springer-Verlag, New York, NY, 1999.
C. Calcagno, S. Ishtiaq, and P.W. O’Hearn. Semantic analysis of pointer aliasing, allocation and disposal in Hoare logic. In ACM-SIGPLAN 2nd International Conference on Principles and Practice of Declarative Programming (PPDP 2000). ACM Press, September 2000.
P. Cohen. Set Theory and the Continuum Hypothesis. Benjamin, San Fancisco, 1966.
P. Cousot. Methods and logics for proving programs. In J. van Leeuwen, editor, Handbook of Theoretical Computer Science, volume B, pages 843–993. Elsevier, Amsterdam, and The MIT Press, Cambridge, Mass., 1990.
F. de Boer. A WP calculus for OO. In Proceedings of FOSSACS’99, 1999.
F. Honsell, I. A. Mason, S. Smith, and C. Talcott. A variable typed logic of effects. Information and Computation, 119(1):55–90, may 1995.
S. Ishtiaq and P.W. O’Hearn. BI as an assertion language for mutable data structures. To appear in POPL’01, 2001.
R. Jones and R. Lins. Garbage Collection. Wiley, 1996.
S. Mac Lane and I. Moerdijk. Sheaves in Geometry and Logic. Springer-Verlag, 1992.
D. C. Oppen and S. A. Cook. Proving assertions about programs that manipulate data structures. In Conference Record of Seventh Annual ACM Symposium on Theory of Computation, pages 107–116, Albuquerque, New Mexico, 5-7 May 1975.
J.C. Reynolds. Intuitionistic reasoning about shared mutable data structure. In Millenial Perspectives in Computer Science, Palgrave, 2000.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Calcagno, C., O’Hearn, P.W. (2001). On Garbage and Program Logic. In: Honsell, F., Miculan, M. (eds) Foundations of Software Science and Computation Structures. FoSSaCS 2001. Lecture Notes in Computer Science, vol 2030. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45315-6_9
Download citation
DOI: https://doi.org/10.1007/3-540-45315-6_9
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-41864-1
Online ISBN: 978-3-540-45315-4
eBook Packages: Springer Book Archive