| |
|
Can garbage collector control the activities of a thread?
Garbage Collection - Garbage collection is a heap-management strategy where a run-time
component takes responsibility for managing the lifetime of the memory used by objects. This
concept is not new to .NET - Java and many other languages/runtimes have used garbage collection
for some time. The garbage collector runs periodically. It runs through a list of objects that
are currently being referenced by an application. All objects that it does not find during this
search are ready to be destroyed (using the finalize method) and hence free the memory. However,
the runtime gets notified of the object that has been destroyed, only in the next round of the
garbage collector's periodic cycle.
In the class System.GC, there is a method called collect( ). This forces the garbage collector
to collect all unreferenced objects immediately, thereby giving the developer some control over
the garbage collector.
There is a gcConcurrent setting that can be set through the applications's .config file. This
specifies whether or not the garbage collector performs its activities on a specified thread
or not.
We can view the performance monitor to view the activities of the garbage collector.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
| |