Generational garbage collection for lazy graph reduction
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.
KeywordsGarbage collection Generational Graph reduction Lazy Functional Updating
Unable to display preview. Download preview PDF.
- [App92]Andrew W. Appel. Compiling with Continuations. Cambridge University Press, 1992.Google Scholar
- [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
- [Joh87]T. Johnsson. Compiling Lazy Functional Languages. PhD thesis, Chalmers Tekniska Högskola, Göteborg, Sweden, 1987.Google Scholar
- [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
- [Pey91]S.L. Peyton Jones. The spineless tagless g-machine: second attempt. Publication forthcoming, 1991.Google Scholar
- [San91]Patrick M. Sansom. Dual-mode garbage collection. In Proceedings of the 1991 Glasgow Functional Programming Workshop, 1991.Google Scholar