A number of possible approaches to automatic memory management in C++ have been considered over the years. Here we propose the reconsideration of an approach that relies on partially conservative garbage collection. Its principal advantage is that objects referenced by ordinary pointers may be garbage-collected. Unlike other approaches, this makes it possible to garbage-collect objects allocated and manipulated by most legacy libraries. This makes it much easier to convert existing code to a garbage-collected environment. It also means that it can be used, for example, to “repair ” legacy code with deficient memory management. The approach taken here is similar to that taken by Bjarne Stroustrup’s much earlier proposal (N0932=96-0114). Based on prior discussion on the core reflector, this version does insist that implementations make an attempt at garbage collection if so requested by the application. However, since there is no real notion of space usage in the standard, there is no way to make this a substantive requirement. An implementation that “garbage collects ” by deallocating all collectable memory at process exit will remain conforming, though it is likely to be unsatisfactory for some uses.
To submit an update or takedown request for this paper, please submit an Update/Correction/Removal Request.