article
Free Access

Simple garbage-collector-safety

Published:01 May 1996Publication History

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.

References

  1. ANSI89 Standard)(3.159-1989, American National Standard for Information Systems- Programming Language- C, American National Standards Institute, Inc.Google ScholarGoogle Scholar
  2. AtkinsonEtAl89 Atkinson, Russ, Alan Demers, Carl Hauser, Christian Jacobi, Peter Kessler, and Mark Weiser, "Experiences Creating a Portable Cedar", Proceedings of the ACM SiGPLAN '89 Conference on Programming Language Design and Implementation, SIGPLAN Notices 24, 7 (July 1989), pp. 322-329. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. AustinBreachSohi94 Austin, Todd M., Scott E. Breach, and Gurindar S. Sohi, "Efficient Detection of all Pointer and Array Access Errors", Proceedings of the ACM SiGPLAN 94 Conference on Programming Language Design and Implementation, SIGPLAN Notices 29, 6 (June 1994), pp. 290-301. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bartlett88 Bartlett, Joel F. "Compacting garbage collection with ambiguous roots", Lisp Pointers 1, 6 (April-June 1988), lap. 3-12.Google ScholarGoogle Scholar
  5. Bartlett89 Bartlett, Joel F., Scheme-O C a Portable Scheme to-C Compiler, WRL Research Report 89/1, Digital Equipment Corporation Western Research Laboratory, January 1989.Google ScholarGoogle Scholar
  6. Boehm93 Boehm, Hans-J., "Space Efficient Conservative Garbage Collection", Proceedings of the ACM SiGPLAN ~93 Conference on Programming Language Design and Implementation, SiGPLAN Notices 28, 6 (June 1993), pp. 197-206. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Boehm94 The SPARC scheduler is available from parcf~p.xerox.com:pub/gc/sched.tar. Z. It also operates in a GC-safe mode, along the lines of {BoehmChase92}.Google ScholarGoogle Scholar
  8. Boehm95 An overview of our conservative garbage collector along with the source code can be accessed from ilia://parcftp.xerox.com/p u b / gc/gc.html.Google ScholarGoogle Scholar
  9. BoehmChase92 Boehm, Hans-J, and David Chase, A Proposal for GC-Safe C Compilation, The Journal of C Language Translation 4, 2 (December, 1992), pp. 126-141. Also available (with the publishers permission) from parcftp.xerox.com:pub/gc/boecha, ps.Z.Google ScholarGoogle Scholar
  10. BoehmDemersShenker91 Boehm, H., A. Demers, and S. Shenker,"Mostly Parallel Garbage Collection", Proceedings of the ACM SIGPLAN ~1 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 157-164. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. BoehmWeiser88 Boehm, Hans-J. and Mark Weiser, "Garbage collection in an uncooperative environment", Software Practice & Experience 18, 9 (Sept. 1988), pp. 807-820. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. DiwanMossHudson92 Diwan, Amer, Eliot Moss, Richard Hudson, "Compiler Support for Garbage Collection in a Static~y Typed Language", ACM SIGPLAN '92 Conference on Programming Language Design and Implementation, SIGPLAN Notices 27, 7 (July 1992), pp. 273-282. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. DetlefsDosserZorn93 Detlefs, David, A1 Dosser, and Benjamin Zorn, "Memory Allocation Costs in Large C and C + + Programs", University of Colorado, Boulder Technical Report CU-CS-665-93. Available for ftp from cs.colorado.edu:pub/techreports/zom/CU- CS-665-93.ps.Z.Google ScholarGoogle Scholar
  14. Edelson91 Edelson, Daniel, "A Mark-and-Sweep Collector for C + + ", Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Albuquerque, New Mexico, January 1992, pp. 51-58. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. EllisDetlefs93 Ellis, John R., and David L. Detlefs, "Safe Efficient Garbage Collection for C + +", Xerox PARC Technical Report CSL-93-4, September 1993. Also available from parcftp.xerox.com:pub/ellis/gc/gc, ps.Google ScholarGoogle Scholar
  16. Fradet94 Fradet, Pascal, "Collecting More Garbage", Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pp. 24-33. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Goldberg91 Goldberg, Benjamin, 'Wag-Free Garbage Collection for Strongly Typed Programming Languages", ACM SIGPLAN '91 Conference on Programming Language Design and Implementation, SIGPLAN Notices 26, 6 (June 1991), pp. 165-176. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. HastingsJoyce92 Hastings, Reed, and Bob Joyce, "Fast Detection of Memory Leaks and Access Errors", Proceedings of the Winter 92 USENIX conference, pp. 125-136.Google ScholarGoogle Scholar
  19. JonesKelly95 Jones, Richard, and Paul Kelly, "Bounds Checking for C", http://wwwala. doc. ic.ac.uk/~ phjk/BoundsChecking.html.Google ScholarGoogle Scholar
  20. Omohundro91 Omohundro, Stephen M., The Sather Language, ICSI, Berkeley, 1991.Google ScholarGoogle Scholar
  21. OTooleNettles94 O'Toole, James, and Scott Nettles, "Concurrent Replicating Garbage Collection", Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pp. 34-42. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. RoseMuller92 Rose, John R., and Hans Muller, "Integrating the Scheme and C languages", Proceedings of the 1992 ACM Conference on Lisp and Functional Programming, pp. 247-259. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Rovner85 Rovner, Paul, "On Adding Garbage Collection and Runtime Types to a Strongly-Typed Statically Checked, Concurrent Language", Technical Report CSL-84-7, Xerox Palo Alto Research Center, Palo Alto, CA, July 1985.Google ScholarGoogle Scholar
  24. SchelterBallantyne88 Schelter, W. F., and M. Ballantyne, "Kyoto Common Lisp", AI Expert 3, 3 (1988), pp. 75-77. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Simple garbage-collector-safety

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 31, Issue 5
                May 1996
                300 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/249069
                Issue’s Table of Contents
                • cover image ACM Conferences
                  PLDI '96: Proceedings of the ACM SIGPLAN 1996 conference on Programming language design and implementation
                  May 1996
                  300 pages
                  ISBN:0897917952
                  DOI:10.1145/231379

                Copyright © 1996 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 1 May 1996

                Check for updates

                Qualifiers

                • article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!