Before we understand what tracing algorithms are, we must first understand the meaning of the phrase “root set of references” . Essentially the root set of references are those references that are always accessible to an executing Java program. They constitute local variables, method arguments, class variables, and instance variables. When triggered, tracing algorithms mark all objects on the heap that can be traced from the root set of references. These are objects that are directly or indirectly referenced by the root set. Let's consider these to be live objects. This forms the mark phase of the tracing algorithm. The mark phase is followed by a sweep phase, in which all objects that were not marked in the mark phase are garbage collected. Because of it's two phases, this type of tracing algorithm is also known as “mark and sweep” algorithm. Advantages: Can detect and handle cycles Disadvantages: The heap is fragmented, ater the sweep phase. Having a fra
Write Awesome User Manuals and Tutorials for Software Products