The space cost of lazy reference counting

  • Authors:
  • Hans-J. Boehm

  • Affiliations:
  • HP Laboratories, Palo Alto, CA

  • Venue:
  • Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languages
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

Reference counting memory management is often advocated as a technique for reducing or avoiding the pauses associated with tracing garbage collection. We present some measurements to remind the reader that classic reference count implementations may in fact exhibit longer pauses than tracing collectors.We then analyze reference counting with lazy deletion, the standard technique for avoiding long pauses by deferring deletions and associated reference count decrements, usually to allocation time. Our principal result is that if each reference count operation is constrained to take constant time, then the overall space requirements can be increased by a factor of Ω(R) in the worst case, where R is the ratio between the size of the largest and smallest allocated object. This bound is achievable, but probably large enough to render this design point useless for most real-time applications.We show that this space cost can largely be avoided if allocating an $n$ byte object is allowed to additionally perform O(n) reference counting work.