|
ABSTRACT
C++ has traditionally relied on manual memory management. Sometimes this has been augmented by limited reference counting, implemented in libraries, and requiring use of separate pointer types. In spite of the fact that conservative garbage collectors have been used with C for decades, and with C++ for almost as long, they have not been well-supported by language standards. This in turn has limited their use. We have led an effort to change this by supporting optional "transparent" garbage collection in the next C++ standard. This is designed to either garbage collect or detect leaks in code using normal unadorned C++ pointers. We initially describe an ambitious effort that would have allowed programmers to explicitly request garbage collection. It faced a number of challenges, primarily in correct interaction with existing libraries relying on explicit destructor invocation. This effort was eventually postponed to the next round of standardization. This initial effort was then temporarily replaced by minimal support in the language that officially allows garbage collected implementations. Such minimal support is included in the current committee draft for the next C++ standard. It imposes an additional language restriction that makes it safe to garbage collect C++ programs. Stating this restriction proved subtle. We also provide narrow interfaces that make it easy to both correct code violating this new restriction, and to supply hints to a conservative garbage collector to improve its performance. These provide interesting implementation challenges. We discuss partial solutions.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
 |
1
|
|
| |
2
|
D. Blake. Programming languages: Everyone has a favorite one. Dr. Dobb's Journal, 18(3), April 2008.
|
| |
3
|
H.-J. Boehm. A garbage collector for C and C++. http://www.hpl.hp.com/personal/Hans_Boehm/gc/.
|
 |
4
|
|
 |
5
|
|
| |
6
|
H.-J. Boehm. Fast multiprocessor memory allocation and garbage collection. Technical Report HPL-2000-165, HP Laboratories, December 2000.
|
 |
7
|
|
 |
8
|
|
 |
9
|
Hans-J. Boehm, Destructors, finalizers, and synchronization, Proceedings of the 30th ACM SIGPLAN-SIGACT symposium on Principles of programming languages, p.262-272, January 15-17, 2003, New Orleans, Louisiana, USA
|
 |
10
|
|
 |
11
|
Hans-J. Boehm , Alan J. Demers , Scott Shenker, Mostly parallel garbage collection, Proceedings of the ACM SIGPLAN 1991 conference on Programming language design and implementation, p.157-164, June 24-28, 1991, Toronto, Ontario, Canada
|
| |
12
|
H.-J. Boehm and M. Spertus. N2261: Optimization-robust finalization. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2261.html.
|
| |
13
|
H.-J. Boehm and M. Spertus. N2310: Transparent programmer-directed garbage collection for c++. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2310.pdf.
|
| |
14
|
H.-J. Boehm, M. Spertus, and C. Nelson. N2670: Minimal support for garbage collection and reachability-based leak detection (revised). http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2670.htm.
|
| |
15
|
|
| |
16
|
W. Bright. Digital mars. http://www.digitalmars.com/.
|
 |
17
|
|
| |
18
|
G. Colvin, B. Dawes, P. Dimov, and D. Adler. Boost smart pointer library. http://www.boost.org/libs/smart\_ptr/.
|
| |
19
|
|
| |
20
|
J. R. Ellis and D. L. Detlefs. Safe, efficient garbage collection for C++. Technical Report CSL-93-4, Xerox Palo Alto Research Center, September 1993.
|
| |
21
|
R. Hastings and B. Joyce. Purify: Fast detection of memory leaks and access errors. In Winter Usenix Conference, pages 125--136, 1992.
|
| |
22
|
H. Hinnant. N2771: Lwg issues. http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2771.html.
|
 |
23
|
|
| |
24
|
ISO/IEC JTC1/SC22/WG21. ISO/IEC 14882, Programming Language - C++ (Oct 2008 committee draft). http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2800.pdf.
|
| |
25
|
M. Kapur. Using the c/c++garbage collection library, libgc. http://developers.sun.com/solaris/articles/libgc.html.
|
| |
26
|
|
 |
27
|
|
| |
28
|
P. Rovner. 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, July 1985.
|
 |
29
|
|
| |
30
|
D. Vandevoorde. N2073: Modules in c++ (revision 4). http://www.open--std.org/jtc1/sc22/wg21/docs/papers/2006/n2073.pdf.
|
|