
1. unreferenced objects are not reclaimed immediately.
2. mark-and-sweep algorithm is called a tracing garbage collector.
3. The objects that a program can access directly are those objects which are referenced by local variables on the processor stack as well as by any static variables that refer to objects. In the context of garbage collection, these variables are called the roots .
4. An object is indirectly accessible if it is referenced by a field in some other (directly or indirectly) accessible object. An accessible object is said to be live.Conversely, an object which is not live is garbage
5. The first phase is called the mark phase. In the second phase, the garbage collection algorithm scans through the heap and reclaims all the unmarked objects.
Advantage:
1. it is able to correctly identify and collect garbage even in the presence of reference cycles.
2. the normal manipulations of reference variables incurs no overhead
Disadvantage:
1.the execution of the program is suspended temporarily while the mark-and-sweep algorithm collects all the garbage.
very nice blog pls visit my blog chiptechkarnal
ReplyDelete