Skip to main content

Generational garbage collection without temporary space leaks for lazy functional languages

  • Conference paper
  • First Online:
Memory Management (IWMM 1995)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 986))

Included in the following conference series:

Abstract

Generational garbage collection is an established method for creating efficient garbage collectors. Even a simple implementation where all nodes that survive one garbage collection are tenured, i.e., moved to an old generation, works well in strict languages. In lazy languages, however, such an implementation can create severe temporary space leaks.

To completely abandon the idea with generational garbage collection for lazy languages is however an overkill since the fundamental idea behind generational garbage collection, that the mortality of young nodes are higher than for old nodes, is valid also for lazy languages.

This paper describes a generational garbage collector that avoids many of the temporary space leaks introduced by a simple generational collector. The main differences between this generational collector and other generational collectors are that no test is needed before updating nodes, and the way aging of nodes are handled. The latter makes it very easy to have different tenure policies for nodes of different types. The former makes it possible to change between non-generational and generational garbage collection at run-time. This is an advantage as the choice of garbage collector often depends on the amount of memory available when runing the program.

The garbage collector is implemented for the Chalmers Lazy-ML/Haskell compiler, and is compared with the original two-space copying garbage collector and a simple generational garbage collector that tenures all nodes that survive one collection.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. L. Augustsson and T. Johnsson. The Chalmers Lazy-ML Compiler. The Computer Journal, 32(2):127–141, 1989.

    Google Scholar 

  2. Andrew W. Appel. Simple generational garbage collector and fast allocation. Software-Practice and Experience, 19(2):171–183, 1989.

    Google Scholar 

  3. L. Augustsson. A Compiler for Lazy ML. In Proceedings of the 1984 ACM Symposium on Lisp and Functional Programming, pages 218–227, Austin, Texas, 1984.

    Google Scholar 

  4. M. Carlsson and T. Hallgren. Fudgets — A Graphical User Interface in a Lazy Functional Language. In FPCA '93 — Conference on Functional Programming Languages and Computer Architecture, pages 321–330. ACM Press, June 1993.

    Google Scholar 

  5. C. J. Cheney. A nonrecursive list compacting algorithm. Communications of the ACM, 13:677–679, 1970.

    Google Scholar 

  6. T. Johnsson. Efficient Compilation of Lazy Evaluation. In Proceedings of the SIGPLAN '84 Symposium on Compiler Construction, pages 58–69, Montreal, 1984.

    Google Scholar 

  7. H. B. M. Jonkers. A fast garbage compaction algorithm. Information Processing Letters, 9:26–30, July 1979.

    Google Scholar 

  8. Henry Lieberman and Carl Hewitt. A real-time garbage collector based on the lifetime of objects. Communications of the ACM, 23(6):412–429, 1983.

    Google Scholar 

  9. S. L. Peyton Jones. The Implementation of Functional Programming Languages. Prentice Hall, 1987.

    Google Scholar 

  10. S. L. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming, 2(2), April 1992.

    Google Scholar 

  11. S. L. Peyton Jones and Jon Salkild. The Spineless Tagless G-machine. In Proceedings of the 1989 Conference on Functional Programming Languages and Computer Architecture, London, Great Britain, 1989.

    Google Scholar 

  12. Niklas Röjemo. A Generational Garbage Collector for a Parallel Graph Reducer. In International Workshop on Memory Mangement, volume 637 of Lecture Notes in Computer Science, pages 440–453. Springer-Verlag, September 1992.

    Google Scholar 

  13. Patrick M. Sansom. Combining copying and compacting garbage collection. In Functional Programming, Glasgow. Springer-Verlag, 1991.

    Google Scholar 

  14. Julian Seward. Generational Garbage Collection for Lazy Graph Reduction. In International Workshop on Memory Mangement, volume 637 of Lecture Notes in Computer Science, pages 200–217. Springer-Verlag, 1992.

    Google Scholar 

  15. Robert A. Shaw. Empirical analysis of a Lisp system. PhD thesis, Stanford University, February 1988. Available as Technical Report CSL-TR-88-351.

    Google Scholar 

  16. Patrick M. Sansom and Simon L. Peyton Jones. Generational garbage collection for haskell. In Proc. 6th Int'l Conf. on Functional Programming Languages and Computer Architecture (FPCA'93), pages 106–116. ACM Press, June 1993.

    Google Scholar 

  17. David Ungar. Generational scavenging: A non-disruptive high performance storage reclamation algorithm. In Proceedings of the ACM Symposium on Practical Software Development Environments, volume 32, pages 157–167, April 1984.

    Google Scholar 

  18. E. P. Wentworth. Pitfalls of conservative garbage collection. SoftwarePractice and Experience, 20(7):719–727, 1990.

    Google Scholar 

  19. John Wild, Hugh Glaser, and Pieter Hartel. Statistics on storage management in a lazy functional language implementation. In Proceedings of the 3rd Conference on Parallel and distributed processing, 1991.

    Google Scholar 

  20. Paul R. Wilson and Thomas G. Moher. Design of the opportunistic garbage collector. In SIGPLAN Conference on Object Oriented Programming Systems, Languages and Implementations, pages 23–35. ACM, October 1989.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Henry G. Baler

Rights and permissions

Reprints and permissions

Copyright information

© 1995 Springer-Verlag

About this paper

Cite this paper

Röjemo, N. (1995). Generational garbage collection without temporary space leaks for lazy functional languages. In: Baler, H.G. (eds) Memory Management. IWMM 1995. Lecture Notes in Computer Science, vol 986. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-60368-9_22

Download citation

  • DOI: https://doi.org/10.1007/3-540-60368-9_22

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-60368-9

  • Online ISBN: 978-3-540-45511-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics