Generational garbage collection for lazy graph reduction

  • Julian Seward
Functional Languages
Part of the Lecture Notes in Computer Science book series (LNCS, volume 637)


Although the LISP community have been exploiting the fruits of generational garbage collection for some time, little attempt has been made to apply these ideas in lazy functional language implementations. This paper attempts to plug that gap.

The action of overwriting an unevaluated thunk with its final value, known as updating, is central to lazy reduction systems. Unfortunately, updating creates pointers from older to younger generations. A simple two-generation scheme which allows heap occupancy to approach 100% is presented. This collector is a hybrid semispace and mark-scan collector. We show that keeping track of old-to-new pointers imposes virtually zero time and space overhead on the mutator. Consequently a net performance gain can be had by using generational collection.

This paper describes how a generational collector was incorporated into a standard G-machine interpreter. Detailed performance measurements presented indicate that a significant improvement in overall performance is achieved, compared to both semispace and compacting mark-scan collectors. Some interesting variants of the basic scheme are discussed. Finally, a possible compiled-code implementation is presented.


Garbage collection Generational Graph reduction Lazy Functional Updating 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [App92]
    Andrew W. Appel. Compiling with Continuations. Cambridge University Press, 1992.Google Scholar
  2. [Aug84]
    L. Augustsson. A compiler for lazy ML. In Proceedings of the 1984 ACM Symposium on Lisp and Functional Programming, pages 218–227, Austin, Texas, August 1984.Google Scholar
  3. [Che70]
    C. J. Cheney. A nonrecursive list compacting algorithm. Communications of the ACM, 13:677–678, November 1970.CrossRefGoogle Scholar
  4. [Joh87]
    T. Johnsson. Compiling Lazy Functional Languages. PhD thesis, Chalmers Tekniska Högskola, Göteborg, Sweden, 1987.Google Scholar
  5. [Jon79]
    H. B. M. Jonkers. A fast garbage compaction algorithm. Information Processing Letters, 9:26–30, July 1979.CrossRefGoogle Scholar
  6. [Pey87]
    S.L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice-Hall International Series in Computer Science. Prentice-Hall International (UK) Ltd, London, 1987.Google Scholar
  7. [Pey91]
    S.L. Peyton Jones. The spineless tagless g-machine: second attempt. Publication forthcoming, 1991.Google Scholar
  8. [San91]
    Patrick M. Sansom. Dual-mode garbage collection. In Proceedings of the 1991 Glasgow Functional Programming Workshop, 1991.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1992

Authors and Affiliations

  • Julian Seward
    • 1
  1. 1.Department of Computer ScienceVictoria University of ManchesterManchesterUK

Personalised recommendations