A simple and efficient algorithm for cycle collection

  • Authors:
  • Chin-Yang Lin;Ting-Wei Hou

  • Affiliations:
  • National Cheng Kung University, Taiwan, R.O.C.;National Cheng Kung University, Taiwan, R.O.C.

  • Venue:
  • ACM SIGPLAN Notices
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

The lack of collecting cyclic garbage is generally considered the major weakness of reference counting. Reference counted systems handle this problem by incorporating either a global tracing collector, or a "partial" tracing collector that considers only the cycle candidates but needs several traces on them. In particular, the latter has become a preferred one as it has better scalability and locality (no need to scan the entire heap). This paper presents a new "lightweight" cyclic reference counting algorithm, which is based on partial tracing and deals with the cycle problem in a simpler and more efficient way. By exploiting the lightweight hypothesis that considers a single sub-graph, instead of individual cycles, as the basic unit of cycle collection, the algorithm can detect garbage cycles in a single trace. In addition, we propose a technique for eliminating redundant scans over garbage objects, thus improving the efficiency of the algorithm. The pseudocode and its correctness proof are also presented. Finally, an implementation based on Jikes Research Virtual Machine is provided to demonstrate the effectiveness of the new algorithm.