top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is garbage collection in context of .net? How to force garbage collector to run?

+5 votes
405 views
What is garbage collection in context of .net? How to force garbage collector to run?
posted Feb 11, 2015 by Vrije Mani Upadhyay

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote
 
Best answer

.NET’s garbage collector has been sold to us as the end of explicit memory management, and of memory leaks, in Windows applications: the idea is that, with a garbage collector running in the background, developers no longer need to worry about the need to manage the life-cycle of the objects they create - the garbage collector will take care of them once the application has finished with them.

The reality is more complicated than this, however. The garbage collector certainly solves the most common leaks in unmanaged programs - those caused by developers forgetting to release memory when they have finished with it. It also solves the related problem of memory being released too soon, but the way in which this is solved can lead to memory leaks when the garbage collector has a different opinion to the developer about whether or not an object is still ‘live’ and able to be used. Before fixing these problems, you need some understanding of how the collector works.

For More Information :https://msdn.microsoft.com/en-us/library/ms973837.aspx

answer Feb 13, 2015 by Rajneesh
...