skip to main content
research-article

An efficient non-moving garbage collector for functional languages

Published:19 September 2011Publication History
Skip Abstract Section

Abstract

Motivated by developing a memory management system that allows functional languages to seamlessly inter-operate with C, we propose an efficient non-moving garbage collection algorithm based on bitmap marking and report its implementation and performance evaluation.

In our method, the heap consists of sub-heaps Hi | ciB of exponentially increasing allocation sizes (Hi for 2i bytes) and a special sub-heap for exceptionally large objects. Actual space for each sub-heap is dynamically allocated and reclaimed from a pool of fixed size allocation segments. In each allocation segment, the algorithm maintains a bitmap representing the set of live objects. Allocation is done by searching for the next free bit in the bitmap. By adding meta-level bitmaps that summarize the contents of bitmaps hierarchically and maintaining the current bit position in the bitmap hierarchy, the next free bit can be found in a small constant time for most cases, and in log32(segmentSize) time in the worst case on a 32-bit architecture. The collection is done by clearing the bitmaps and tracing live objects. The algorithm can be extended to generational GC by maintaining multiple bitmaps for the same heap space. The proposed method does not require compaction and objects are not moved at all. This property is significant for a functional language to inter-operate with C, and it should also be beneficial in supporting multiple native threads.

The proposed method has been implemented in a full-scale Standard ML compiler. Our benchmark tests show that our non-moving collector performs as efficiently as a generational copying collector designed for functional languages.

Skip Supplemental Material Section

Supplemental Material

_talk6.mp4

References

  1. H. G. Baker. The treadmill: real-time garbage collection without motion sickness. SIGPLAN Notices, 27(3):66--70, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. K. Barabash, O. B.-Yitzhak, I. Goft, E. K. Kolodner, V. Leikehman, Y. Ossia,A. Owshanko, and E. Petrank. A parallel, incremental, mostly concurrent garbage collector for servers. ACM Transactions on Programming Languages and Systems,27:1097--1146, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. J. F. Bartlett. Compacting garbage collection with ambiguous roots. SIGPLAN Lisp Pointers, 1(6):3--12, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. S. M. Blackburn and K. S. McKinley. Immix: a mark-region garbage collector with space efficiency, fast collection, and mutator performance. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 22--32, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. H.-J. Boehm. Reducing garbage collector cache misses. In Proceedings of the International Symposium on Memory management, pages 59--64, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. H.-J. Boehm and M. Weiser. Garbage collection in an uncooperative environment. Software Practice and Experience, 18(9):807--820, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. E. Chailloux, P. Manoury, and B. Pagano. Developing applications with Objective Caml. O'Reilly, April 2000. French version.Google ScholarGoogle Scholar
  8. C. J. Cheney. A nonrecursive list compacting algorithm. Communications of the ACM, 13(11), 1970. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Y. C. Chung, S.-M. Moon, K. Ebcioğlu, and D. Sahlin. Selective sweeping. Software Practice and Experience, 35(1):15--26, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Demers, M. Weiser, B. Hayes, H. Boehm, D. Bobrow, and S. Shenker. Combining generational and conservative garbage collection: framework and implementations. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 261--269, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. D. Detlefs, C. Flood, S. Heller, and T. Printezis. Garbage-first garbage collection. In Proceedings of the International Symposium on Memory Management, pages 37--48, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Dimpsey, R. Arora, and K. Kuiper. Java server performance: a case study of building efficient, scalable Jvms. IBM Systems Journal, 39(1):151--174, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Doligez and X. Leroy. A concurrent, generational garbage collector for a multithreaded implementation of ML. In Proceedings of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 113--123, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. K. Dybvig. The development of Chez Scheme. In Proceedings of the ACM International Conference on Functional Programming, pages 1--12, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. K. Dybvig, D. Eby, and C. Bruggeman. Don't stop the BIBOP: Flexible and efficient storage management for dynamically-typed languages. Technical report, Indiana University, 1994.Google ScholarGoogle Scholar
  16. R. J. M. Hughes. A semi-incremental garbage collection algorithm. Software Practice and Experience, 12(11):1081--1082, 1982.Google ScholarGoogle ScholarCross RefCross Ref
  17. R. Jones and R. Lins. Garbage collection: algorithms for automatic dynamic memory management. John Wiley & Sons, Inc., 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. G. L. Steele Jr. Data representation in PDP-10 MACLISP. MIT AI Memo 421, September 1977.Google ScholarGoogle Scholar
  19. H. Kermany and E. Petrank. The Compressor: concurrent, incremental, and parallel compaction. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 354--363, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html.Google ScholarGoogle Scholar
  21. H. Lieberman and C. Hewitt. A real-time garbage collector based on the lifetimes of objects. Communications of the ACM, 26(6):419--429, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Marlow, T. Harris, R. P. James, and S. P. Jones. Parallel generational-copying garbage collection with a block-structured heap. In Proceedings of the International Symposium on Memory Management, pages 11--20, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Marlow, S. P. Jones, and S. Singh. Runtime support for multicore Haskell. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming, pages 65--78, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. J. McCarthy. Recursive functions of symbolic expressions and their computation by machine, Part I. Communications of the ACM, 3(4):184--195, April 1960. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. H.-D. Nguyen and A. Ohori. Compiling ML polymporphism with explicit layout bitmap. In Proceedings of the ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming, pages 237--248, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. F. Pizlo, D. Frampton, E. Petrank, and B. Steensgaard. Stopless: a real-time garbage collector for multiprocessors. In Proceedings of the International Symposium on Memory management, pages 159--172, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. F. Pizlo, L. Ziarek, P. Maj, A. L. Hosking, E. Blanton, and J. Vitek. Schism: fragmentation-tolerant real-time garbage collection. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 146--159, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. C. Queinnec, B. Beaudoing, and J.-P. Queille. Mark during sweep rather than mark then sweep. In Proceedings of the Parallel Architectures and Languages Europe, Volume I: Parallel Architectures, pages 224--237, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. J. H. Reppy. A high-performance garbage collector for Standard ML. Technical report, AT&T Bell Laboratories Technical Memo, 1994.Google ScholarGoogle Scholar
  30. K. Sagonas and J. Wilhelmsson. Mark and split. In Proceedings of the International Symposium on Memory Management, pages 29--39, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. P. M. Sansom and S. L. P. Jones. Generational garbage collection for Haskell. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pages 106--116, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. F. Smith and G. Morrisett. Comparing mostly-copying and mark-sweep conservative collection. In Proceedings of the International Symposium on Memory Management, pages 68--78, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. SML# compiler. http://www.pllab.riec.tohoku.ac.jp/smlsharp/.Google ScholarGoogle Scholar
  34. D. Spoonhower, G. Blelloch, and R. Harper. Using page residency to balance tradeoffs in tracing garbage collection. In Proceedings of the ACM/USENIX International Conference on Virtual Execution Environments, pages 57--67, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. D. Ungar. Generation scavenging: A non-disruptive high performance storage reclamation algorithm. In Proceedings of the ACM SIGSOFT/SIGPLAN Software Engineering Symposium on Practical Software Development Environments, pages 157--167, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. H. S. Warren. Hacker's Delight. Addison-Wesley Longman Publishing Co., Inc., 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. P. R. Wilson, M. S. Johnstone, M. Neely, and D. Boles. Dynamic storage allocation: A survey and critical review. In Proceedings of the International Workshop on Memory Management, pages 1--116, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. B. Zorn. Comparing mark-and-sweep and stop-and-copy garbage collection. In Proceedings of the ACM Conference on LISP and Functional Programming, pages 87--98, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. An efficient non-moving garbage collector for functional languages

Recommendations

Comments

Login options

Check if you have access through your login credentials or your institution to get full access on this article.

Sign in

Full Access

  • Published in

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 46, Issue 9
    ICFP '11
    September 2011
    456 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2034574
    Issue’s Table of Contents
    • cover image ACM Conferences
      ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programming
      September 2011
      470 pages
      ISBN:9781450308656
      DOI:10.1145/2034773

    Copyright © 2011 ACM

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    • Published: 19 September 2011

    Check for updates

    Qualifiers

    • research-article

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader
About Cookies On This Site

We use cookies to ensure that we give you the best experience on our website.

Learn more

Got it!