What is Garbage collection? How to run garbage collector forcefully?

What is Garbage collection? How to run garbage collector forcefully? Garbage collection is a CLR feature which automatically manage memory.Developers forget to release the object while coding. CLR automatically release objects when they are no longer in use and reference. CLR runs on non-deterministic to see the unused objects and clean them.One side effects of this non-deterministic feature is that we can not assume anObject is destroyed when it is outside the scope of a function

How to run garbage collector forcefully?

System.GC.Collect(). This is not recommended but can be used if the situation demands .


Leave a Reply

Your email address will not be published. Required fields are marked *