skip to main content
10.1145/1028976.1028982acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
Article

A unified theory of garbage collection

Authors Info & Claims
Published:01 October 2004Publication History

ABSTRACT

Tracing and reference counting are uniformly viewed as being fundamentally different approaches to garbage collection that possess very distinct performance properties. We have implemented high-performance collectors of both types, and in the process observed that the more we optimized them, the more similarly they behaved - that they seem to share some deep structure.

We present a formulation of the two algorithms that shows that they are in fact duals of each other. Intuitively, the difference is that tracing operates on live objects, or "matter", while reference counting operates on dead objects, or "anti-matter". For every operation performed by the tracing collector, there is a precisely corresponding anti-operation performed by the reference counting collector.

Using this framework, we show that all high-performance collectors (for example, deferred reference counting and generational collection) are in fact hybrids of tracing and reference counting. We develop a uniform cost-model for the collectors to quantify the trade-offs that result from choosing different hybridizations of tracing and reference counting. This allows the correct scheme to be selected based on system performance requirements and the expected properties of the target application.

References

  1. APPEL, A. W. Simple generational garbage collection and fast allocation. Software - Practice and Experience 19, 2 (1989), 171--183. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. APPEL,A.W.,ELLIS, J. R., AND LI, K. Real-time concurrent collection on stock multiprocessors. In Proceedings of the SIGPLAN'88 Conference on Programming Language Design and Implementation (Atlanta, Georgia, June 1988). SIGPLAN Notices, 23, 7 (July), 11--20. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. BACON,D.F.,ATTANASIO, C. R., LEE, H. B., RAJAN,V.T., AND SMITH, S. Java without the coffee breaks: A nonintrusive mul-tiprocessor garbage collector. In Proc. of the SIGPLAN Conference on Programming Language Design and Implementation (Snowbird, Utah, June 2001). SIGPLAN Notices, 36, 5 (May), 92--103. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. BACON,D.F.,CHENG,P.,AND RAJAN, V. T. Controlling fragmentation and space consumption in the Metronome, a real-time garbage collector for Java. In Proceedings of the Conference on Languages, Compilers, and Tools for Embedded Systems (San Diego, California, June 2003). SIGPLAN Notices, 38, 7, 81--92. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. BACON,D.F.,CHENG,P.,AND RAJAN, V. T. A real-time garbage collector with low overhead and consistent utilization. In Proceedings of the 30th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (New Orleans, Louisiana, Jan. 2003). SIGPLAN Notices, 38, 1, 285--298. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. BACON,D.F.,AND RAJAN, V. T. Concurrent cycle collection in reference counted systems. In European Conference on Object-Oriented Programming (Budapest, Hungary, June 2001), J. L. Knudsen, Ed., vol. 2072 of Lecture Notes in Computer Science, Springer-Verlag, pp. 207--235. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. BAKER, H. G. List processing in real-time on a serial computer. Commun. ACM 21, 4 (Apr. 1978), 280--294. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. BAKER, H. G. The Treadmill, real-time garbage collection without motion sickness. SIGPLAN Notices 27, 3 (Mar. 1992), 66--70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. BARTH, J. M. Shifting garbage collection overhead to compile time. Commun. ACM 20, 7 (July 1977), 513--518. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. BISHOP,P.B.Computer Systems with a Very Large Address Space and Garbage Collection. PhD thesis, Laboratory for Computer Science, Massachussets Institute of Technology, May 1977. MIT/LCS/TR-178.Google ScholarGoogle Scholar
  11. BLACKBURN, S. M., JONES, R., MCKINLEY, K. S., AND MOSS,J. E. B. Beltway: getting around garbage collection gridlock. In Proc. of the SIGPLAN Conference on Programming Language Design and Implementation (Berlin, Germany, June 2002). SIGPLAN Notices, 37, 5, 153--164. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. BLACKBURN, S. M., AND MCKINLEY, K. S. Ulterior reference counting: Fast garbage collection without a long wait. In Proceedings of the Conference on Object-oriented Programing, Systems, Languages, and Applications (Anaheim, California, Oct. 2003). SIG-PLAN Notices, 38, 11, 344--358. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. BROOKS, R. A. Trading data space for reduced time and code space in real-time garbage collection on stock hardware. In Conference Record of the 1984 ACM Symposium on Lisp and Functional Programming (Austin, Texas, Aug. 1984), G. L. Steele, Ed., pp. 256--262. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. CHEADLE, A. M., FIELD,A.J.,MARLOW, S., PEYTON JONES, S. L., AND WHILE, R. L. Non-stop Haskell. In Proc. of the Fifth International Conference on Functional Programming (Montreal, Quebec, Sept. 2000). SIGPLAN Notices, 35, 9, 257--267. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. CHENEY, C. J. A nonrecursive list compacting algorithm. Commun. ACM 13, 11 (1970), 677--678. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. CHENG,P.,AND BLELLOCH, G. A parallel, real-time garbage collector. In Proc. of the SIGPLAN Conference on Programming Language Design and Implementation (Snowbird, Utah, June 2001). SIGPLAN Notices, 36, 5 (May), 125--136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. CHRISTOPHER, T. W. Reference count garbage collection. Software - Practice and Experience 14, 6 (June 1984), 503--507.Google ScholarGoogle ScholarCross RefCross Ref
  18. COLLINS, G. E. A method for overlapping and erasure of lists. Commun. ACM 3, 12 (Dec. 1960), 655--657. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. DETREVILLE, J. Experience with concurrent garbage collectors for Modula-2+. Tech. Rep. 64, DEC Systems Research Center, Aug. 1990.Google ScholarGoogle Scholar
  20. DEUTSCH,L.P.,AND BOBROW, D. G. An efficient incremental automatic garbage collector. Commun. ACM 19, 7 (July 1976), 522--526. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. DIJKSTRA,E.W.,LAMPORT, L., MARTIN, A. J., SCHOLTEN, C. S., AND STEFFENS, E. F. M. On-the-fly garbage collection: An exercise in cooperation. In Hierarchies and Interfaces, F. L. Bauer et al., Eds., vol. 46 of Lecture Notes in Computer Science. Springer-Verlag, 1976, pp. 43--56. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. DOLIGEZ, D., AND LEROY, X. A concurrent generational garbage collector for a multi-threaded implementation of ML. In Conf. Record of the Twentieth ACM Symposium on Principles of Programming Languages (Jan. 1993), pp. 113--123. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. HENRIKSSON,R.Scheduling Garbage Collection in Embedded Systems. PhD thesis, Lund Institute of Technology, July 1998.Google ScholarGoogle Scholar
  24. HIRZEL, M., DIWAN, A., AND HERTZ, M. Connectivity-based garbage collection. In Proceedings of the Conference on Object-oriented Programing, Systems, Languages, and Applications (Anaheim, California, Oct. 2003). SIGPLAN Notices, 38, 11, 359--373. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. HUDSON, R. L., AND MOSS, J. E. B. Incremental collection of mature objects. In Proc. of the International Workshop on Memory Management (St. Malo, France, Sept. 1992), Y. Bekkers and J. Cohen, Eds., vol. 637 of Lecture Notes in Computer Science, pp. 388--403. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. JOHNSTONE,M.S.Non-Compacting Memory Allocation and Real-Time Garbage Collection. PhD thesis, University of Texas at Austin, Dec. 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. KUNG,H.T.,AND SONG, S. W. An efficient parallel garbage collection system and its correctness proof. In IEEE Symposium on Foundations of Computer Science (1977), pp. 120--131.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. LAMPORT, L. Garbage collection with multiple processes: an exercise in parallelism. In Proc. of the 1976 International Conference on Parallel Processing (1976), pp. 50--54.Google ScholarGoogle Scholar
  29. LANG, B., QUENNIAC, C., AND PIQUER, J. Garbage collecting the world. In Conference Record of the Nineteenth Annual ACM Symposium on Principles of Programming Languages (Jan. 1992), SIG-PLAN Notices, pp. 39--50. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. LAROSE, M., AND FEELEY, M. A compacting incremental collector and its performance in a production quality compiler. In Proc. of the First International Symposium on Memory Management (Vancouver, B.C., Oct. 1998). SIGPLAN Notices, 34, 3 (Mar., 1999), 1--9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. LEVANONI,Y.,AND PETRANK, E. An on-the-fly reference counting garbage collector for java. In Proceedings of the 16th ACM SIGPLAN conference on Object Oriented Programming, Systems, Languages, and Applications (Tampa Bay, Florida, Oct. 2001), pp. 367--380. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. MARTÍNEZ, A. D., WACHENCHAUZER, R., AND LINS, R. D. Cyclic reference counting with local mark-scan. Inf. Process. Lett. 34,1 (1990), 31--35. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. MCCARTHY, J. Recursive functions of symbolic expressions and their computation by machine. Commun. ACM 3, 4 (1960), 184--195. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. NETTLES, S., AND O'TOOLE, J. Real-time garbage collection. In Proc. of the SIGPLAN Conference on Programming Language Design and Implementation (June 1993). SIGPLAN Notices, 28, 6, 217--226. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. ROSENBLUM, M., AND OUSTERHOUT, J. K. The design and implementation of a log-structured file system. In Proc. of the Thirteenth ACM symposium on Operating Systems Principles (Pacific Grove, California, Oct. 1991). SIGOPS Operating Systems Review, 25,5,1--15. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. SCHORR, H., AND WAITE, W. M. An efficient machine-independent procedure for garbage collection in various list structures. Commun. ACM 10, 8 (1967), 501--506. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. SELIGMANN, J., AND GRARUP, S. Incremental mature garbage collection using the Train algorithm. In Ninth European Conference on Object-Oriented Programming (Åarhus, Denmark, 1995), W. G. Olthoff, Ed., vol. 952 of Lecture Notes in Computer Science, pp. 235--252. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. SHUF,Y.,GUPTA, M., BORDAWEKAR, R., AND SINGH, J. P. Exploiting prolific types for memory management and optimizations. In Proceedings of the 29th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Portland, Oregon, Jan. 2002). SIGPLAN Notices, 37, 1, 295--306. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. STEELE, G. L. Multiprocessing compactifying garbage collection. Commun. ACM 18, 9 (Sept. 1975), 495--508. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. STEFANOVIC, D., MCKINLEY,K.S.,AND MOSS, J. E. B. Age-based garbage collection. In Proc. of the Conference on Object-Oriented Programming, Systems, Languages, and Applications (Denver, Colorado, Oct. 1999). SIGPLAN Notices, 34, 10, 370--381. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. UNGAR, D. M. 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 (Pittsburgh, Pennsylvania, 1984), P. Henderson, Ed. SIGPLAN Notices, 19, 5, 157--167. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. WEIZENBAUM, J. Symmetric list processor. Commun. ACM 6,9 (Sept. 1963), 524--536. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. WEIZENBAUM, J. Recovery of reentrant list structures in SLIP. Commun. ACM 12, 7 (July 1969), 370--372. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. YUASA, T. Real-time garbage collection on general-purpose machines. Journal of Systems and Software 11, 3 (Mar. 1990), 181--198. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. ZEE, K., AND RINARD, M. Write barrier removal by static analysis. In Proc. of the Conference on Object-Oriented Programming, Systems, Languages, and Applications (Seattle, Washington, Oct. 2002), ACM Press. SIGPLAN Notices, 37, 11 (Nov.), 191--210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. ZORN, B. Barrier methods for garbage collection. Tech. Rep. CU-CS-494-90, University of Colorado at Boulder, 1990.Google ScholarGoogle Scholar

Index Terms

  1. A unified theory of garbage collection

    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
    • Published in

      cover image ACM Conferences
      OOPSLA '04: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications
      October 2004
      462 pages
      ISBN:1581138318
      DOI:10.1145/1028976
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 39, Issue 10
        OOPSLA '04
        October 2004
        448 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1035292
        Issue’s Table of Contents

      Copyright © 2004 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 October 2004

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      Overall Acceptance Rate268of1,244submissions,22%

      Upcoming Conference

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader