A Lightweight Cyclic Reference Counting Algorithm

  • Chin-Yang Lin
  • Ting-Wei Hou
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3947)


This paper focuses on a major weakness of reference counting technique – the lack of collecting cyclic garbage. Most reference counted systems handle this problem by either invoking a global mark-sweep collector occasionally, or incorporating a local ("partial") tracing collector that considers only the cycle candidates (objects) but needs several traces on them. This paper proposes a "lightweight" cycle detector, which is based on the partial tracing approach but collects garbage cycles in a simpler and more efficient way. Key to the algorithm is the removal of multiple traces on the cycle candidates – It effectively reclaims garbage cycles in only one trace. We have evaluated the algorithm in the Jikes Research Virtual Machine, where a set of benchmark programs from SPECjvm98 were applied. The experiments demonstrate the efficiency and practicability of the lightweight cycle detector, compared to a modern cycle detector that requires multiple traces on objects.


Local Search Work Unit Garbage Collection Internal Pointer External Pointer 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Alpern, B., et al.: Implementing Jalapeño in Java. In: OOPSLA 1999 Conference Proceedings: Object-Oriented Programming Systems, Languages, and Applications, Denver, Colorado (October 1999); SIGPLAN Notices 34(10), 314–324 (1999)Google Scholar
  2. 2.
    Bacon, D.F., Attanasio, C.R., Lee, H.B., Rajan, V.T., Smith, S.: Java without the coffee breaks: A nonintrusive multiprocessor garbage collector. In: Proceedings of SIGPLAN 2001 Conference on Programming Languages Design and Implementation. ACM SIGPLAN Notices, Snowbird, Utah (June 2001)Google Scholar
  3. 3.
    Bacon, D.F., Rajan, V.T.: Concurrent cycle collection in reference counted systems. In: Knudsen, J.L. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 207–235. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  4. 4.
    Blackburn, S.M., Cheng, P., McKinley, K.S.: Oil and water? High performance garbage collection in Java with MMTk. In: International Conference on Software Engineering (2004)Google Scholar
  5. 5.
    Blackburn, S.M., McKinley, K.S.: Ulterior reference counting: Fast garbage collection without a long wait. In: ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, Anaheim, CA, pp. 244–358 (2003)Google Scholar
  6. 6.
    Christopher, T.W.: Reference count garbage collection. Software Practice and Experience 14(6), 503–507 (1984)CrossRefGoogle Scholar
  7. 7.
    Collins, G.E.: A method for overlapping and erasure of lists. Commun. ACM 3(12), 655–657 (1960)MathSciNetCrossRefGoogle Scholar
  8. 8.
    Detreville, J.: Experience with concurrent garbage collectors for Modula-2+. Tech. Rep. 64, DEC Systems Research Center, Palo Alto, California (1990)Google Scholar
  9. 9.
    Deutsch, L.P., Bobrow, D.G.: An efficient incremental automatic garbage collector. Commun. ACM 19(9), 522–526 (1976)CrossRefMATHGoogle Scholar
  10. 10.
    Jones, R.E., Lins, R.D.: Cyclic weighted reference counting without delay. In: Bode, A., Reeve, M., Wolf, G. (eds.) PARLE 1993. LNCS, vol. 694, pp. 712–715. Springer, Heidelberg (1993)CrossRefGoogle Scholar
  11. 11.
    Jones, R.E., Lins, R.D.: Garbage Collection. John Wiley and Sons, Chichester (1996)MATHGoogle Scholar
  12. 12.
    Levanoni, Y., Petrank, E.: A scalable reference counting garbage collector. Technical Report CS-0967, Technion - Israel Institute of Technology, Haifa, Israel (November 1999)Google Scholar
  13. 13.
    Levanoni, Y., Petrank, E.: An on-the-fly reference counting garbage collector for Java. In: ACM Conference Proceedings on Object-Oriented Programming Systems, Languages, and Applications, Tampa, FL, pp. 367–380 (2001)Google Scholar
  14. 14.
    Lins, R.D.: An efficient algorithm for cyclic reference counting. Inf. Process. Lett. 83, 145–150 (2002)MathSciNetCrossRefMATHGoogle Scholar
  15. 15.
    Lins, R.D.: Cyclic reference counting with lazy mark-scan. Inf. Process. Lett. 44(4), 215–220 (1992)CrossRefMATHGoogle Scholar
  16. 16.
    Lins, R.D.: Generational cyclic reference counting. Inf. Process. Lett. 46(1), 19–20 (1993)CrossRefMATHGoogle Scholar
  17. 17.
    Martinez, A.D., Wachenchauzer, R., Lins, R.D.: Cyclic reference counting with local mark-scan. Inf. Process. Lett. 34(1), 31–35 (1990)CrossRefMATHGoogle Scholar
  18. 18.
    McBeth, J.H.: On the reference counter method. Commun. ACM 6(9), 575 (1963)CrossRefGoogle Scholar
  19. 19.
    McCarthy, J.: Recursive functions of symbolic expressions and their computation by machine. Commun. ACM 3, 184–195 (1960)CrossRefMATHGoogle Scholar
  20. 20.
    Paz, H., Petrank, E., Bacon, D.F., Rajan, V.T., Kolodner, E.K.: An efficient on-the-fly cycle collection. In: Proceedings of the 14th International Conference on Compiler Construction, Edinburgh. Springer, Heidelberg (2005)Google Scholar
  21. 21.
    Standard Performance Evaluation Corporation: Specjvm98 documentation (March 1999)Google Scholar
  22. 22.
    Ye, X., Keane, J.: Collecting cyclic garbage in distributed systems. In: International Symposium on Parallel Architectures, Algorithms and Networks, Taipei, Taiwan (1997)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Chin-Yang Lin
    • 1
  • Ting-Wei Hou
    • 1
  1. 1.Department of Engineering ScienceNational Cheng Kung UniversityTainanTaiwan

Personalised recommendations