TGC (Template garbage collector) | ||||||||||
|
TGC is a garbage collector for C++ designed for generic
template libraries such as the Standard Template Library (STL).
Class templates represent a particular challenge to
garbage collectors because the memory layout of a template object
varies, depending on the types that instantantiate the class templates,
and important properties such as the size of
an object or the (non-)existence of internal pointers
no longer are fixed.
The lack of type information at program design time implies restrictions
for the two collection techniques that are known for C++.
Fully conservative mark-sweep collectors run in non-optimized mode only, while
mostly-copying collectors with traditional pointer locators fail to work
at all. TGC is a mostly-copying collector with a new pointer locator that
works with templates and can perform optimizations for the various
types that instantiate them.
TGC distinguishes two groups of users: designers of generic libraries and users of those libraries. The former ones, following rigorous performance requirements and the C++ philosophy not to pay for features that are not used, won't integrate TGC if other parts of the library would slow down thereby. The latter ones, not necessarily expert programmers, won't use TGC if its set-up is too complicated. The different demands of the two types of users are reflected in the design of TGC.
Portability:
Tests: the Boehm-Weiser-Demers collector is a mark-sweep collector that requires no cooperation by the library designer. For library users it is as easy to use as TGC. In most of our test cases it improved the memory usage of the user program, sometimes significantly. Those interested in a comparison of the two collectors can follow this link to the latest tests. Related work:
Authors: Gor Nishanov, Sibylle Schupp Acknowledgements: When designing TGC we gained from the study of the 3 collectors for C++ that are publicly available. Our thanks are to J. Bartlett, the CMM group, especially G. Attardi and T. Flagelli, and H. Boehm, M. Weiser, and A. Demers for providing their collectors and making the source code available. |
|||||||||
|
|
|||