HEAP GARBAGE COLLECTION WITH REFERENCE COUNTING

Wuu Yang, Huei-Ru Tseng, Rong-Hong Jan

Abstract

In algorithms based on reference counting, a garbage-collection decision has to be made whenever a pointer x !y is about to be destroyed. At this time, the node y may become dead even if y’s reference count is not zero. This is because y may belong to a piece of cyclic garbage. Some aggressive collection algorithms will put y on the list of potential garbage regardless of y’s reference count. Later a trace procedure starting from y will be initiated. Other algorithms, less aggressive, will put y on the list of potential garbage only if y’s reference count falls below a threshold, such as 3. The former approach may waste time on tracing live nodes and the latter may leave cyclic garbage uncollected indefinitely. The problem with the above two approaches (and with reference counting in general) is that it is difficult to decide if y is dead when the pointer x ! y is destroyed. We propose a new garbage-collection algorithm in which each node maintains two, rather than one, reference counters, gcount and hcount. Gcount is the number of references from the global variables and from the run-time stack. Hcount is the number of references from the heap. Our algorithm will put node y on the list of potential garbage if and only if y’s gcount becomes 0. The better prediction made by our algorithm results in more efficient garbage collectors.

References

  1. Bacon, D. F., Attanasio, C. R., Lee, H. B., Rajan, V. T., and Smith, S. (2001). Java without the coffee breaks: A nonintrusive multiprocessor garbage collector. In Proc. ACM SIGPLAN'01 Conf. Programming Languages Design and Implementation (PLDI).
  2. Bacon, D. F. and Rajan, V. T. (2001). Concurrent cycle collection in reference counted systems. In Proc. 15th European Conf. Object-Oriented Programming. Springer-Verlag, LNCS 2072.
  3. Christopher, T. W. (1984). Reference count garbage collection. Software Practice and Experience, 14(6):503- 507.
  4. Collins, G. E. (1960). A method for overlapping and erasure of lists. Communications of the ACM, 3(12):655-657.
  5. Fischer, C. N. and LeBlanc, R. J. J. (1991). Crafting a Compiler with C. Benjamin/Cummings, MA.
  6. Jones, R. E. and Lins, R. D. (1996). Garbage Collection Algorithms for Dynamic Memory Management. John Wiley and Sons, New York.
  7. Lin, C. Y. (2009). Efficient Cyclic Garbage Reclamation Appraoch for Reference Coounted Memory Management Systems, Ph.D. Dissertation. National ChengKung University, Tainan, Taiwan, R.O.C.
  8. Lin, C. Y. and Hou, T. W. (2006). A lightweight cyclic reference counting algorithm. In Proc. International Conf. Grid and Pervasive Computing. SpringerVerlag, LNCS 3947.
  9. Lin, C. Y. and Hou, T. W. (2007). A simple and efficient algorithm for cycle collection. ACM Sigplan Notices, 42(3):7-13.
Download


Paper Citation


in Harvard Style

Yang W., Tseng H. and Jan R. (2010). HEAP GARBAGE COLLECTION WITH REFERENCE COUNTING . In Proceedings of the 5th International Conference on Software and Data Technologies - Volume 2: ICSOFT, ISBN 978-989-8425-23-2, pages 267-270. DOI: 10.5220/0002917502670270


in Bibtex Style

@conference{icsoft10,
author={Wuu Yang and Huei-Ru Tseng and Rong-Hong Jan},
title={HEAP GARBAGE COLLECTION WITH REFERENCE COUNTING},
booktitle={Proceedings of the 5th International Conference on Software and Data Technologies - Volume 2: ICSOFT,},
year={2010},
pages={267-270},
publisher={SciTePress},
organization={INSTICC},
doi={10.5220/0002917502670270},
isbn={978-989-8425-23-2},
}


in EndNote Style

TY - CONF
JO - Proceedings of the 5th International Conference on Software and Data Technologies - Volume 2: ICSOFT,
TI - HEAP GARBAGE COLLECTION WITH REFERENCE COUNTING
SN - 978-989-8425-23-2
AU - Yang W.
AU - Tseng H.
AU - Jan R.
PY - 2010
SP - 267
EP - 270
DO - 10.5220/0002917502670270