Hostname: page-component-8448b6f56d-qsmjn Total loading time: 0 Render date: 2024-04-18T14:40:39.378Z Has data issue: false hasContentIssue false

Integrating region memory management and tag-free generational garbage collection

Published online by Cambridge University Press:  22 February 2021

MARTIN ELSMAN
Affiliation:
University of Copenhagen, Denmark, (e-mail: mael@di.ku.dk)
NIELS HALLENBERG
Affiliation:
SimCorp A/S, Denmark, (e-mail: niels.hallenberg@simcorp.com)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We present a region-based memory management scheme with support for generational garbage collection. The scheme features a compile-time region inference algorithm, which associates values with logical regions, and builds on a region type system that deploys region types at runtime to avoid the overhead of write barriers and to support partly tag-free garbage collection. The scheme is implemented in the MLKit Standard ML compiler, which generates native x64 machine code. Besides demonstrating a number of important formal properties of the scheme, we measure the scheme’s characteristics, for a number of benchmarks, and compare the performance of the generated executables with the performance of executables generated with the MLton state-of-the-art Standard ML compiler and configurations of the MLKit with and without region inference and generational garbage collection enabled. Although region inference often serves the purpose of generations, combining region inference with generational garbage collection is shown often to be superior to combining region inference with non-generational collection despite the overhead introduced by a larger amount of memory waste, due to region fragmentation.

Type
Research Article
Copyright
© The Author(s), 2021. Published by Cambridge University Press

References

Aditya, S., Flood, C. H. & Hicks, J. E. (1994) Garbage collection for strongly-typed languages using run-time type reconstruction. In LISP and Functional Programming, pp. 1223.CrossRefGoogle Scholar
Aiken, A., Fähndrich, M. & Levien, R. (1995) Better static memory management: Improving region-based analysis of higher-order languages. In ACM Conference on Programming Languages and Implementation. PLDI 1995.CrossRefGoogle Scholar
Aldrich, J., Kostadinov, V. & Chambers, C. (2002) Alias annotations for program understanding. In ACM Conference on Object-oriented Programming, Systems, Languages, and Applications. OOPSLA 2002.CrossRefGoogle Scholar
Anderson, T. A. (2010) Optimizations in a private nursery-based garbage collector. In ACM International Symposium on Memory Management. ISMM 2010.CrossRefGoogle Scholar
Appel, A. W. (1989) Runtime tags aren’t necessary. Lisp Sym. Comput. 2, 153162.Google Scholar
Birkedal, L., Tofte, M. & Vejlstrup, M. (1996) From region inference to von Neumann machines via region representation inference. In ACM Symposium on Principles of Programming Languages. POPL 1996.CrossRefGoogle Scholar
Blanchet, B. (1998) Escape analysis : Correctness proof, implementation and experimental results. ACM Symposium on Principles of Programming Languages (POPL 1998). ACM Press, pp. 2537.Google Scholar
Boyapati, C., Salcianu, A., Beebee, Jr., W. & Rinard, M. (2003) Ownership types for safe region-based memory management in real-time Java. In ACM Conference on Programming Language Design and Implementation. PLDI 2003.CrossRefGoogle Scholar
Calcagno, C., Helsen, S. & Thiemann, P. (2002) Syntactic type soundness results for the region calculus. Inform. Comput. 173(2).CrossRefGoogle Scholar
Doligez, D. & Leroy, X. (1993) A concurrent, generational garbage collector for a multithreaded implementation of ML. In ACM Symposium on Principles of Programming Languages. POPL ’93.CrossRefGoogle Scholar
Elsman, M. (1998) Polymorphic equality—no tags required. In Second International Workshop on Types in Compilation.CrossRefGoogle Scholar
Elsman, M. (2003) Garbage collection safety for region-based memory management. In ACM Workshop on Types in Language Design and Implementation. TLDI 2003.CrossRefGoogle Scholar
Elsman, M. (2008) A Framework for Cut-Off Incremental Recompilation and Inter-Module Optimization. Technical report. IT University of Copenhagen, Rued Langgaards Vej 7, DK-2300 Copenhagen S, Denmark.Google Scholar
Elsman, M. & Hallenberg, N. (1995) An Optimizing Backend for the ML Kit Using a Stack of Regions. Student Project 95-7-8, University of Copenhagen (DIKU).Google Scholar
Elsman, M. & Hallenberg, N. (2003) Web programming with SMLserver. In International Symposium on Practical Aspects of Declarative Languages (PADL 2003). Springer-Verlag.Google Scholar
Elsman, M. & Hallenberg, N. (2020) On the effects of integrating region-based memory management and generational garbage collection in ML. In Practical Aspects of Declarative Languages. PADL 2020. Springer International Publishing, pp. 95112.CrossRefGoogle Scholar
Elsman, M., Munksgaard, P. & Larsen, K. F. (2018) Experience report: Type-safe multi-tier programming with Standard ML modules. In Proceedings of the ML Family Workshop. ML 2018.Google Scholar
Fluet, M., Morrisett, G. & Ahmed, A. (2006) Linear regions are all you need. Program. Lang. Syst. ESOP 2006. Springer Berlin Heidelberg, pp. 721.Google Scholar
Gay, D. & Aiken, A. (2001) Language support for regions. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2001). ACM Press.Google Scholar
Goldberg, B. (1991) Tag-free garbage collection for strongly typed programming languages. In ACM Conference on Programming Language Design and Implementation pp. 165176.CrossRefGoogle Scholar
Goldberg, B. & Gloger, M. (1992) Polymorphic type reconstruction for garbage collection without tags. In LISP and Functional Programming pp. 5365.CrossRefGoogle Scholar
Hallenberg, N. (1996) A Region Profiler for a Standard ML compiler based on Region Inference. Student Project 96-5-7, Department of Computer Science, University of Copenhagen (DIKU).Google Scholar
Hallenberg, N., Elsman, M. & Tofte, M. (2002) Combining region inference and garbage collection. In ACM Conference on Programming Language Design and Implementation (PLDI 2002). ACM Press. Berlin, Germany.Google Scholar
Hanson, D. R. (1980) A portable storage management system for the icon programming language. Softw. Pract. Exp. 10, 489500.CrossRefGoogle Scholar
Helsen, S. & Thiemann, P. (2000) Syntactic type soundness for the region calculus. In International Workshop on Higher Order Operational Techniques in Semantics. Published in Volume 41(3) of the Electronic Notes in Theoretical Computer Science.CrossRefGoogle Scholar
Huelsbergen, L. & Winterbottom, P. (1998) Very concurrent mark-&-sweep garbage collection without fine-grain synchronization. In ACM International Symposium on Memory Management. ISMM 1998.Google Scholar
Jones, R., Hosking, A. & Moss, E. (2011) The Garbage Collection Handbook: The Art of Automatic Memory Management. Chapman & Hall/CRC.CrossRefGoogle Scholar
Jost, S., Hammond, K., Loidl, H.-W. & Hofmann, M. (2010) Static determination of quantitative resource usage for higher-order programs. In ACM Symposium on Principles of Programming Languages. POPL 2010.CrossRefGoogle Scholar
Marlow, S. & Peyton Jones, S. (2011) Multicore garbage collection with local heaps. In ACM International Symposium on Memory Management. ISMM 2011.CrossRefGoogle Scholar
Marlow, S., Peyton Jones, S. & Singh, S. (2009) Runtime support for multicore Haskell. In ACM International Conference on Functional Programming. ICFP 2009.CrossRefGoogle Scholar
Morrisett, G. (1995) Compiling with Types. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA 15213.Google Scholar
Morrisett, G., Felleisen, M. & Harper, R. (1995) Abstract models of memory management. In International Conference on Functional Programming Languages and Computer Architecture, San Diego, pp. 6677.Google Scholar
Morrisett, G., Tarditi, D., Cheng, P., Stone, C., Harper, R. & Lee, P. (1996) The TIL/ML Compiler: Performance and Safety through Types.Google Scholar
Reppy, J. H. (1994) A High-performance Garbage Collector for Standard ML. Tech. rept. AT&T Bell Laboratories.Google Scholar
Salagnac, G., Yovine, S. & Garbervetsky, D. (2005) Fast escape analysis for region-based memory management. Electron. Notes Th. C. S. 131(May), 99110.CrossRefGoogle Scholar
Salagnac, G., Nakhli, C., Rippert, C. & Yovine, S. (2006) Efficient region-based memory management for resource-limited real-time embedded systems. In Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems.CrossRefGoogle Scholar
Swamy, N., Hicks, M., Morrisett, G., Grossman, D. & Jim, T. (2006) Safe manual memory management in cyclone. Sci. Comput. Program. 62(2), 122144.CrossRefGoogle Scholar
Tarditi, D., Morrisett, G., Cheng, P., Stone, C., Harper, R. & Lee, P. (1996) TIL: A type-directed optimizing compiler for ML. In Proceedings of ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, pp. 181192.CrossRefGoogle Scholar
Tofte, M. & Birkedal, L. (1998) A region inference algorithm. Trans. Program. Lang. Syst. (TOPLAS) 20(4), 734767.Google Scholar
Tofte, M. & Birkedal, L. (2000) Unification and polymorphism in region inference. In Proof, Language, and Interaction. Essays in Honour of Robin Milner May. (25 pages).Google Scholar
Tofte, M. & Talpin, J.-P. (1993) A Theory of Stack Allocation in Polymorphically Typed Languages. Tech. rept. DIKU-report 93/15. Department of Computer Science, University of Copenhagen.Google Scholar
Tofte, M. & Talpin, J.-P. (1997) Region-based memory management. Inform. Comput. 132(2), 109176.CrossRefGoogle Scholar
Tofte, M., Birkedal, L., Elsman, M. & Hallenberg, N. (2004) A retrospective on region-based memory management. Higher-Order Symb. Comput. 17(3), 245265.CrossRefGoogle Scholar
Tofte, M., Birkedal, L., Elsman, M., Hallenberg, N., Olesen, T. H. & Sestoft, P. (2006) Programming with Regions in the MLKit (Revised for Version 4.3.0). Tech. Rept. IT University of Copenhagen, Denmark.Google Scholar
Tolmach, A. P. (1994) Tag-free garbage collection using explicit type parameters. In LISP and Functional Programming pp. 111.CrossRefGoogle Scholar
Ueno, K. & Ohori, A. (2016) A fully concurrent garbage collector for functional programs on multicore processors. In ACM International Conference on Functional Programming. ICFP 2016.CrossRefGoogle Scholar
Wright, A. K. & Felleisen, M. (1994) A syntactic approach to type soundness. Inform. Comput. 115(1), 3894.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.