This is the main disadvantage of a traditional garbage collection reference . The garbage collector property that describes this behavior is an incomplete collector. Other collectors largely fall into the category called trash garbage collectors, which include traditional marking, semi-spatial / compacting and generating hybrids and do not suffer from these shortcomings (but encounter several others). A.
All the JVM and CLI implementations that I know use full collectors, which means that they don’t suffer from the specific problem you are asking for here. As far as I know, of those Jikes, the RVM is the only one that supplies the counting counting collector (one of its many).
Another interesting thing: solving the problem of completeness in counting references to garbage collection, and the resulting collectors demonstrate some interesting performance properties that are difficult to get out of trace collectors. Unfortunately, the most efficient garbage collection algorithms for link counting and most of the completeness modifications rely on the help of the compiler, so converting them to C ++ shared_ptr<T> difficult / does not occur. Instead, we have weak_ptr<T> and documented rules (sorry for the suboptimal link - apparently, the documentation is eluding me) to simply avoid problems. This is not the first time (another mediocre link), we have seen this approach, and we hope that the additional work to prevent memory problems is less than the amount of work needed to support code that does not use shared_ptr<T> , etc.
Middle links are due to the fact that most of my reference material is scattered across notes from the last semester memory management class.
Sam harwell
source share