Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / kiran vaidya

When any new object is created, it has two references
assigned, one is present on the application's stack area
and other is on the GC's stack. With creation of any new
object, it will be automatically assigned the generation as
0.
Now, there are two cases where object's reference is
removed from application stack.

1.When programmer assignes any object as 'null', the
reference on the application's stack to the specific object
is automatically removed.

2.When the function scope is ended, the references to those
objects in the function are automatically removed from
stack.
Now, GC compares the entries of references at its own
stack Vs the entries of references available at the
application stack.
By comparing them, it finds the object's references in
its stack to which, no match was found in the application
stack and releases memory allocated to them.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the new features added in version 4 of mvc (mvc4)?

1014


What are the 3 segments of the default route, that is present in an ASP.NET MVC application?

1094


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

1054


What is the use of razor view engine?

974


What are the benefits of .net framework?

1019


Explain dependency resolution?

1081


What is .net framework used for?

1026


What are the new enhancements done in default project template of asp.net mvc 4?

1044


What are HTML Helpers, AJAX Helpers in ASP.Net MVC?

1047


What is the use of display modes?

1059


Which is the root namespace for fundamental types in .net framework?

1010


Explain how you can send the result back in JSON format in MVC?

997


What is route config?

952


What are the components of the .net framework.

1056


How can I tell what .net framework is installed?

979