How Garbage Collector identifies the objects which are not
in use?

Answer Posted / rahul veer

Garbage Collector determines which objects are no longer
being used by examining the application's roots. In Dot Net
each and every application has a set of roots. Each root
either refers to an object on the managed heap or is set to
null. An application's roots include global and static
object pointers, local variables and reference object
parameters on a thread's stack, and CPU registers. The
garbage collector has access to the list of active roots
that the just-in-time (JIT) compiler and the runtime
maintain. Using this list, it examines an application's
roots, and in the process creates a graph that contains all
the objects that are reachable from the roots. Objects that
are not in the graph are unreachable from the application's
roots. The garbage collector considers unreachable objects
as garbage and not in use.

Is This Answer Correct ?    10 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is http stateful or stateless?

742


What is entity framework? : Entity framework

735


What are ajax helpers in mvc?

693


Explain something about model, view and controllers in asp.net mvc?

743


What is entitytype? : Entity framework

705






what is entityclient?

854


Do I need microsoft .net framework?

724


What is difference between razor and web form engine?

733


What operating systems will the .net framework 3.0 be available for?

768


what is use of entity container?

778


What is object service? : Entity framework

855


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

770


What is the greatest advantage of using asp.net mvc over asp.net webforms?

718


What are the differences between Partial View and Display Template and Edit Templates in ASP.Net MVC?

776


Explain .Net Framework? Why we use it?

785