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 | c ≤ i ≤ B 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.
Supplemental Material
- H. G. Baker. The treadmill: real-time garbage collection without motion sickness. SIGPLAN Notices, 27(3):66--70, 1992. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- J. F. Bartlett. Compacting garbage collection with ambiguous roots. SIGPLAN Lisp Pointers, 1(6):3--12, 1988. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- H.-J. Boehm. Reducing garbage collector cache misses. In Proceedings of the International Symposium on Memory management, pages 59--64, 2000. Google Scholar
Digital Library
- H.-J. Boehm and M. Weiser. Garbage collection in an uncooperative environment. Software Practice and Experience, 18(9):807--820, 1988. Google Scholar
Digital Library
- E. Chailloux, P. Manoury, and B. Pagano. Developing applications with Objective Caml. O'Reilly, April 2000. French version.Google Scholar
- C. J. Cheney. A nonrecursive list compacting algorithm. Communications of the ACM, 13(11), 1970. Google Scholar
Digital Library
- Y. C. Chung, S.-M. Moon, K. Ebcioğlu, and D. Sahlin. Selective sweeping. Software Practice and Experience, 35(1):15--26, 2005. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- R. K. Dybvig. The development of Chez Scheme. In Proceedings of the ACM International Conference on Functional Programming, pages 1--12, 2006. Google Scholar
Digital Library
- 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 Scholar
- R. J. M. Hughes. A semi-incremental garbage collection algorithm. Software Practice and Experience, 12(11):1081--1082, 1982.Google Scholar
Cross Ref
- R. Jones and R. Lins. Garbage collection: algorithms for automatic dynamic memory management. John Wiley & Sons, Inc., 1996. Google Scholar
Digital Library
- G. L. Steele Jr. Data representation in PDP-10 MACLISP. MIT AI Memo 421, September 1977.Google Scholar
- 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 Scholar
Digital Library
- D. Lea. A memory allocator. http://gee.cs.oswego.edu/dl/html/malloc.html.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- J. H. Reppy. A high-performance garbage collector for Standard ML. Technical report, AT&T Bell Laboratories Technical Memo, 1994.Google Scholar
- K. Sagonas and J. Wilhelmsson. Mark and split. In Proceedings of the International Symposium on Memory Management, pages 29--39, 2006. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- SML# compiler. http://www.pllab.riec.tohoku.ac.jp/smlsharp/.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- H. S. Warren. Hacker's Delight. Addison-Wesley Longman Publishing Co., Inc., 2002. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
An efficient non-moving garbage collector for functional languages
Recommendations
An efficient non-moving garbage collector for functional languages
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingMotivated 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 ...
Alligator collector: a latency-optimized garbage collector for functional programming languages
ISMM 2020: Proceedings of the 2020 ACM SIGPLAN International Symposium on Memory ManagementModern hardware and applications require runtime systems that can operate under large-heap and low-latency requirements. For many client/server or interactive applications, reducing average and maximum pause times is more important than maximizing ...
A non-fragmenting non-moving, garbage collector
ISMM '98: Proceedings of the 1st international symposium on Memory managementOne of the biggest disadvantages of non-moving collectors compared to moving collectors has been their limited ability to deal with memory fragmentation. In this paper, we describe two techniques to reduce fragmentation without the need for moving live ...







Comments