Simple garbage-collector-safety

  • Authors:
  • Hans-J. Boehm

  • Affiliations:
  • Xerox PARC

  • Venue:
  • PLDI '96 Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation
  • Year:
  • 1996

Quantified Score

Hi-index 0.02

Visualization

Abstract

A conservative garbage collector can typically be used with conventionally compiled programs written in C or C++. But two safety issues must be considered. First, the source code must not hide pointers from the garbage collector. This primarily requires stricter adherence to existing restrictions in the language definition. Second, we must ensure that the compiler will not perform transformations that invalidate this requirement.We argue that the same technique can be used to address both issues. We present an algorithm for annotating source or intermediate code to either check the validity of pointer arithmetic in the source, or to guarantee that under minimal, clearly defined assumptions about the compiler, the optimizer cannot "disguise" pointers. We discuss an implementation based on a preprocessor for the GNU C compiler (gcc), and give some measurements of program slow down.