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 does Garbage collector(GC) works in .net

Answer Posted / suresh.gv

Garbage Collector&#61516;Mark-sweep algorithm)
If there is any memory defeciency then only GC will called
by CLR.
Low priority thread its run on its own thread.
It calls JIT compiler.
It maintains Apps_route table there all the objects are
maintained.those will seen by garbage collector
3 types of objects:
1. Short Leaved Objects/young objects
&#61656; Objects which are less referenced.
2. Long Leaved Objects/Older Objects
Objects which referenced more
3. Oldest Objects
Objects which are globally accessed
It maintain these objects in to 3 Generations:
Gen0 Gen1 Gen3
promote to --> promote to -->
contains object1 contains object2 contains object3

First goes to Gen-0::
If any object is used then it swaps/promote that object to
Gen-1.otherwise it destroys that object immediately.
Same will happen for Gen-1
Still the memory is adequate then it goes to Gen-2
Still memory is adequate it raise exception
memory insufficient exception
This is called as Non-Deterministic Finalization.

GC destroys only Managed Objects only not UNManaged Objects
Determenistic Finalization queue.
In this
Supress Finalize:: in this destructors will not CALLED


UnManaged Objects:


1.ADO.Net
2.Networking/Socket Programming.
3.IO(File Handling)
4.RCW / CCW / PIS

All the classes can have
&#61558; Close()/dispose()

We have to call them after completion objects usage.

Is This Answer Correct ?    17 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

I have an external link in my application say www.xyztest.com. Today this site works on http protocal. Tommorow it may run on https. So i cant hardcore the protocal in the site. When a user clicks on the link how can i know if the external site works on http or https and takes him to that place?

1851


How can we Validate a Controls in ASP.NET page using JavaScript?

1096


Explain server control extensibility with reference to asp.net 2.0 ?

931


What is the function used for removing an event listener?

972


What is difference between session and cookie?

945


What are assemblies and namespaces and explain the difference between them ?

1025


How to reduce the width of textbox in editcommandcolumn of datagrid?

939


Why is it preferred to not use finalize for clean up?

944


What is asp.net response object?

996


What is an assembly? Explain its parts.

1022


How many types of server controls do we have?Also explain differance between them taking an example of ASP.NET?

2864


What parameters can you pass in the url of the api? Can get and post use the same url?

936


Explain server-side scripting?

996


What are the ways to sending the data in ASP.NET page?

994


What is server side in asp.net?

930