13-03 The Role of Application Roots

Simply put, a root is a storage location containing a reference to an object on the managed heap. 

During a garbage collection process, the runtime will investigate objects on the managed heap to determine whether they are still reachable (i.e., rooted) by the application. To do so, the CLR will build an object graph, which represents each reachable object on the heap

在GC期间,运行时会调查在托管堆上的对象来决定他们是否可以被应用程序接触。为了做这个,CLR建立一个object graph来代表在堆上每个可接触的对象。

After the graph has been constructed, unreachable objects (which we will assume are objects C and F) are marked as garbage.

图被建立以后,不可接触的对象会被标上垃圾。

posted @ 2015-02-09 16:42  海川0  阅读(67)  评论(0)    收藏  举报