skip to main content
article
Free Access

An on-the-fly reference-counting garbage collector for java

Published:01 January 2006Publication History
Skip Abstract Section

Abstract

Reference-counting is traditionally considered unsuitable for multiprocessor systems. According to conventional wisdom, the update of reference slots and reference-counts requires atomic or synchronized operations. In this work we demonstrate this is not the case by presenting a novel reference-counting algorithm suitable for a multiprocessor system that does not require any synchronized operation in its write barrier (not even a compare-and-swap type of synchronization). A second novelty of this algorithm is that it allows eliminating a large fraction of the reference-count updates, thus, drastically reducing the reference-counting traditional overhead. This article includes a full proof of the algorithm showing that it is safe (does not reclaim live objects) and live (eventually reclaims all unreachable objects).We have implemented our algorithm on Sun Microsystems' Java Virtual Machine (JVM) 1.2.2 and ran it on a four-way IBM Netfinity 8500R server with 550-MHz Intel Pentium III Xeon and 2 GB of physical memory. Our results show that the algorithm has an extremely low latency and throughput that is comparable to the stop-the-world mark and sweep algorithm used in the original JVM.

References

  1. Aho, A. V., Kernighan, B. W., and Weinberger, P. J. 1988. The AWK Programming Language. Addison-Wesley, Reading, MA. Google ScholarGoogle Scholar
  2. Appel, A. W., Ellis, J. R., and Li, K. 1988. Real-time concurrent collection on stock multiprocessors. ACM SIGPLAN Not. 23, 7, 11--20. Google ScholarGoogle Scholar
  3. Azatchi, H., Levanoni, Y., Paz, H., and Petrank, E. 2003. An on-the-fly mark and sweep garbage collector based on sliding views. See OOPSLA {2003}, 269--281. Google ScholarGoogle Scholar
  4. Azatchi, H. and Petrank, E. 2003. Integrating generations with advanced reference counting garbage collectors. In International Conference on Compiler Construction (CC'2003). Lecture Notes in Computer Science, vol. 2622. Springer, Berlin, Germany, 185--199. Google ScholarGoogle Scholar
  5. Bacon, D., Attanasio, D., Lee, H., and Smith, S. 2001. Java without the coffee breaks: A nonintrusive multiprocessor garbage collector. In Proceedings of the SIGPLAN 2001 Conference on Programming Languages Design and Implementation. ACM Press, New York, NY, 92--103. Google ScholarGoogle Scholar
  6. Bacon, D. and Rajan, V. 2001. Concurrent cycle collection in reference counted systems. In Proceedings of 15th European Conference on Object-Oriented Programming (ECOOP 2001, Budapest, Hungary). Google ScholarGoogle Scholar
  7. Baker, H. G. 1978. List processing in real-time on a serial computer. Commun. ACM 21, 4, 280--94. Google ScholarGoogle Scholar
  8. Baker, H. G. 1994. Minimizing reference count updating with deferred and anchored pointers for functional data structures. ACM SIGPLAN Not. 29, 9, 38--43. Google ScholarGoogle Scholar
  9. Barth, J. M. 1977. Shifting garbage collection overhead to compile time. Commun. ACM 20, 7 (July), 513--518. Google ScholarGoogle Scholar
  10. Blackburn, S. and McKinley, K. 2003. Ulterior reference counting: Fast garbage collection without a long wait. See OOPSLA {2003}, 344--358. Google ScholarGoogle Scholar
  11. Boehm, H.-J., Demers, A. J., and Shenker, S. 1991. Mostly parallel garbage collection. ACM SIGPLAN Not. 26, 6, 157--164. Google ScholarGoogle Scholar
  12. Chikayama, T. and Kimura, Y. 1987. Multiple reference management in Flat GHC. In 4th International Conference on Logic Programming. MIT Press, Cambridge, MA, 276--293.Google ScholarGoogle Scholar
  13. Collins, G. E. 1960. A method for overlapping and erasure of lists. Commun. ACM 3, 12 (Dec.), 655--657. Google ScholarGoogle Scholar
  14. Crammond, J. 1988. A garbage collection algorithm for shared memory parallel processors. Int. J. Parall. Programm. 17, 6, 497--522. Google ScholarGoogle Scholar
  15. DeTreville, J. 1990. Experience with concurrent garbage collectors for Modula-2+. Tech. rep. 64. DEC Systems Research Center, Palo Alto, CA.Google ScholarGoogle Scholar
  16. Deutsch, L. P. and Bobrow, D. G. 1976. An efficient incremental automatic garbage collector. Commun. ACM 19, 9 (Sept.), 522--526. Google ScholarGoogle Scholar
  17. Dijkstra, E. W., Lamport, L., Martin, A. J., Scholten, C. S., and Steffens, E. F. M. 1978. On-the-fly garbage collection: An exercise in cooperation. Commun. ACM 21, 11 (Nov.), 965--975. Google ScholarGoogle Scholar
  18. Doligez, D. and Gonthier, G. 1994. Portable, unobtrusive garbage collection for multiprocessor systems. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 70--83. Google ScholarGoogle Scholar
  19. Doligez, D. and Leroy, X. 1993. A concurrent generational garbage collector for a multi-threaded implementation of ML. In Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 113--123. Google ScholarGoogle Scholar
  20. Domani, T., Kolodner, E. K., Lewis, E., Salant, E. E., Barabash, K., Lahan, I., Petrank, E., Yanover, I., and Levanoni, Y. 2000. Implementing an on-the-fly garbage collector for Java. See Hosking {2000}, 155--166. Google ScholarGoogle Scholar
  21. Endo, T., Taura, K., and Yonezawa, A. 1997. A scalable mark-sweep garbage collector on large-scale shared-memory machines. In Proceedings of the Conference on High Performance Networking and Computing (SC'97). ACM Press, New York, NY, 1--14. Google ScholarGoogle Scholar
  22. Flood, C., Detlefs, D., Shavit, N., and Zhang, C. 2001. Parallel garbage collection for shared memory multiprocessors. In USENIX Java Virtual Machine Research and Technology Symposium (JVM '01, Monterey, CA). USENIX, Berkeley, CA. Google ScholarGoogle Scholar
  23. Furusou, S., Matsuoka, S., and Yonezawa, A. 1991. Parallel conservative garbage collection with fast allocation. In OOPSLA/ECOOP '91 Workshop on Garbage Collection in Object-Oriented Systems, Addendum to OOPSLA'91 Proceedings, P. R. Wilson and B. Hayes, Eds. ACM Press, New York, NY. Google ScholarGoogle Scholar
  24. Goldberg, A. and Robson, D. 1983. Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA. Google ScholarGoogle Scholar
  25. Halstead, R. H. 1985. Multilisp: A language for concurrent symbolic computation. ACM Trans. Program. Lang. Syst. 7, 4 (Oct.), 501--538. Google ScholarGoogle Scholar
  26. Herlihy, M. and Moss, J. E. B. 1990. Non-blocking garbage collection for multiprocessors. Tech. rep. CRL 90/9. DEC Cambridge Research Laboratory, Cambridge, MA.Google ScholarGoogle Scholar
  27. Hosking, A. L., Moss, J. E. B., and Stefanović, D. 1992. A comparative performance evaluation of write barrier implementations. In Proceedings of the Conference on Object-Oriented Programming, Systems, Languages, and Applications, A. Paepcke, Ed. ACM Press, New York, NY, 92--109. Google ScholarGoogle Scholar
  28. Hosking, T., Ed. 2000. ISMM 2000 Proceedings of the Second International Symposium on Memory Management. ACM Press, New York, NY.Google ScholarGoogle Scholar
  29. Hudson, R. L. and Moss, J. E. B. 2003. Copying garbage collection without stopping the world. Concurr. Computat.: Pract. Exp. 15, 3--5, 223--261.Google ScholarGoogle Scholar
  30. Jones, R. E. and Lins, R. 1996. Garbage Collection: Algorithms for Automatic Dynamic Memory Management. Wiley, Chichester, U.K. Google ScholarGoogle Scholar
  31. Kolodner, E. K. and Petrank, E. 2004. Parallel copying garbage collection using delayed allocation. Parall. Process. Lett. 14, 2. To appear.Google ScholarGoogle Scholar
  32. Levanoni, Y. and Petrank, E. 2001. 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. ACM Press, New York, NY, 367--380. Google ScholarGoogle Scholar
  33. Lins, R. D. and Vasques, M. A. 1991. A comparative study of algorithms for cyclic reference counting. Tech. rep. 92. Computing Laboratory, The University of Kent at Canterbury. Canterbury, U.K.Google ScholarGoogle Scholar
  34. McBeth, J. H. 1963. On the reference counter method. Commun. ACM 6, 9, 575. Google ScholarGoogle Scholar
  35. Miller, J. S. and Epstein, B. 1990. Garbage collection in MultiScheme. In US/Japan Workshop on Parallel Lisp. Lecture Notes in Computer Science, vol. 441. Springer, Berlin, Germany, 138--160. Google ScholarGoogle Scholar
  36. OOPSLA. 2003. Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. ACM Press, New York, NY.Google ScholarGoogle Scholar
  37. Ossia, Y., Ben-Yitzhak, O., Goft, I., Kolodner, E. K., Leikehman, V., and Owshanko, A. 2002. A parallel, incremental and concurrent GC for servers. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Languages Design and Implementation. ACM Press, New York, NY, 129--140. Google ScholarGoogle Scholar
  38. O'Toole, J. W. and Nettles, S. M. 1994. Concurrent replicating garbage collection. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming. ACM Press, New York, NY, 34--42. Google ScholarGoogle Scholar
  39. Park, Y. G. and Goldberg, B. 1995. Static analysis for optimising reference counting. Inf. Process. Lett. 55, 4 (Aug.), 229--234. Google ScholarGoogle Scholar
  40. Plakal, M. and Fischer, C. N. 2000. Concurrent garbage collection using program slices on multithreaded processors. See Hosking {2000}, 94--100. Google ScholarGoogle Scholar
  41. Printezis, T. and Detlefs, D. 2000. A generational mostly-concurrent garbage collector. See Hosking {2000}, 143--154. Google ScholarGoogle Scholar
  42. Riany, Y., Shavit, N., and Touitou, D. 1995. Towards a practical snapshot algorithm. In Proceedings of the 3rd Israeli Symposium on the Theory of Computing and Systems. IEEE Press, Los Alamitos, CA, 58--173. Google ScholarGoogle Scholar
  43. Roth, D. J. and Wise, D. S. 1999. One-bit counts between unique and sticky. In Proceedings of the First International Symposium on Memory Management, R. Jones, Ed. ACM SIGPLAN Not. 34, 3 (Mar.), 49--56. Google ScholarGoogle Scholar
  44. Sobalvarro, P. 1988. A lifetime-based garbage collector for Lisp systems on general-purpose computers. Tech. rep. AITR-1417. MIT AI Lab, Cambridge, MA. Also, Bachelor of Science thesis, Massachusetts Institute of Technology, Cambridge, MA. Google ScholarGoogle Scholar
  45. SPEC Benchmarks. 2000. Standard Performance Evaluation Corporation. Available online at http://www.spec.org/.Google ScholarGoogle Scholar
  46. Steele, G. L. 1975. Multiprocessing compactifying garbage collection. Commun. ACM 18, 9 (Sept.), 495--508. Google ScholarGoogle Scholar
  47. Stoye, W. R., Clarke, T. J. W., and Norman, A. C. 1984. Some practical methods for rapid combinator reduction. In Proceedings of the 1984 ACM Symposium on Lisp and Functional Programming, G. L. Steele, Ed. ACM Press, New York, NY, 159--166. Google ScholarGoogle Scholar
  48. Wall, L. and Schwartz, R. L. 1991. Programming Perl. O'Reilly and Associates, Inc, Sebastopol, CA. Google ScholarGoogle Scholar
  49. Weizenbaum, J. 1963. Symmetric list processor. Commun. ACM 6, 9 (Sept.), 524--544. Google ScholarGoogle Scholar
  50. Wise, D. S. 1993. Stop and one-bit reference counting. Inf. Process. Lett. 46, 5 (July), 243--249. Google ScholarGoogle Scholar
  51. Yuasa, T. 1990. Real-time garbage collection on general-purpose machines. J. Softw. Syst. 11, 3, 181--198. Google ScholarGoogle Scholar
  52. Zorn, B. 1990. Barrier methods for garbage collection. Tech. rep. CU-CS-494-90. University of Colorado, Boulder, CO.Google ScholarGoogle Scholar

Index Terms

  1. An on-the-fly reference-counting garbage collector for java

      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

      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!