Why doesn't the .NET runtime offer deterministic destruction

Answer Posted / kirti

Because of the garbage collection algorithm. The .NET garbage collector works by periodically running through a list of all the objects that are currently being referenced by an application. All the objects that it doesn't find during this search are ready to be destroyed and the memory reclaimed. The implication of this algorithm is that the runtime doesn't get notified immediately when the final reference on an object goes away - it only finds out during the next sweep of the heap.

Futhermore, this type of algorithm works best by performing the garbage collection sweep as rarely as possible. Normally heap exhaustion is the trigger for a collection sweep.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the .net framework and how does it work?

777


Explain the advantages and disadvantages of ASP.Net MVC over ASP.NET?

775


what is entity framework?

846


Is dapper better than entity framework?

769


What is the need of Action Filters in ASP.Net MVC

829


Explain the methods used to render the views in ASP.Net MVC?

899


What is iobjectset? : Entity framework

801


Is .net framework 4.8 the last version?

799


which are the key concepts of entity data model?

843


What is the purpose of a web form?

777


How can I return string result from action in asp.net mvc?

819


What is the difference between viewbag and viewdata in asp.net mvc?

881


Can I remove .net framework?

794


What is a razor file?

747


How the ‘page lifecycle’ of ASP.Net MVC does works?

827