A mostly-copying collector component for class templates
Class templates represent a difficulty for C++ garbage collectors since relevant information is available only very late, at instantiation time. Current collectors therefore either fail to work with class templates or have to run in a non-optimized mode. This paper introduces the template garbage collector (TGC), the first mostly-copying collector that can handle class templates. It discusses the design decisions that are suggested by the specifies of generic template programming and presents performance results and memory measurements of tests with MTL and GTL, two generic C++ libraries based on the Standard Template Library. The tests show that TGC substantially improves the run times of programs with many small objects with short lifetimes or large objects with long lifetimes. The memory usage at the same time is reasonable. Since TGC modifies the mostly-copying technique, the heap sizes are in many cases considerably smaller than they are for traditional mostly-copying collectors, The tests also show that TGC is competitive with the Boehm-Demers-Weiser collector the most widely used collector for C++, Copyright (C) 2001 John Wiley & Sons, Ltd.
tgc garbage collection c plus plus templates generic libraries stl