Software job search
.net sql interview questions
  The best place for technical interview questions

Home.netSql serverAsp.netC#Vb.netAdo.netAjaxMcpd dumpsWord count tool
.net interview questions
Question 19   What is garbage collection

The process of releasing memory objects which are no longer used by an application in a .net environment is known as garbage collection. garbage collector helps the clr to perform better memory management. by default garbage collection is an automatic process which is being executed by the clr. by using gc.collect() method we can force clr to perform garbage collection

Question 20   How does garbage collection work

The process of releasing memory objects which are no longer used by an application in a .net environment is known as garbage collection. garbage collector helps the clr to perform better memory management.

how garbage collector works.

garbage collector uses a managed heap to store objects. newly created object will be at the top of the heap (higher memory addresses) and older objects will be at the bottom.

based on the age of memory objects, garbage collector group objects into to three different groups which are generally known as generations. there will be 3 different generations. generation 0, generation 1, generation 2

generation 0 – all the newly created objects will be in generation 0. after a period of time objects which are still alive in gen 0 will be moved to generation 1.

generation 1 (gen1) – all the objects which were in gen 0 and have survived a series of garbage collection will be moved to gen 1

generation 2 (gen 2) – objects like global variables, static variables will be usually be in gen 3 because they will be alive till the application runs.

collecting the garbage

during a gc operation clr will pause the application execution

there are two types of collection

1) partial collection – it is considered to a very cheap operation. only objects in gen 0 will be released

2) full collection – gc will perform this operation in all generations and it is considered to a an expensive operation

after this process dead objects will be removed from the heap and live objects will be rearranged to fill the gaps. generations also will be updated after this process

Question 21   How finalization affects performance

When the garbage collector runs objects will finalize will not be destroyed immediately. instead it will be moved a finalization queue. also the child objects which are referred to this object cannot be destroyed this time. after the garbage collection finalize thread will execute the finally method and will become dead. these dead objects will be removed only on the next garbage collection.
this is the reason finalization has a bad effect on performance

Question 22   Can we force garbage collector to run

We can force the garbage collector to run using gc.collect() method

Question 23   What is reflection

The method of getting metadata information like type, modules, methods information from an assembly is known as reflection. reflection classes are grouped inside system.reflection namespace. reflection is also used to dynamically invoke methods inside a class.

Question 24   What are different types of jit

Just in time compiler is known as jit and there are three different types of jit in .net

1) enco jit - econo-jit compiles a method only when it is called while execution and after the execution it removes this compiled method from memory

2) pre – jit- pre – jit compiles the entire code to msil during the time of deployment. complete compilation happens in one cycle

3) normal jit - normal jit compiles a method only when it is called. the main difference between enco jit and normal jit is, normal jit caches the compiled code in memory which is known as jitted. when a method called again it will use this cached code from memory

 Rate this page
 34 votes , average 5 out of 5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 

Reader's opinions -

No comments

.net interview questions interview questions
C# interview questions interview questions interview questions
Ajax interview questions
Wcf interview questions
Wpf interview questions
.net threading interview questions
.net remoting and webservices interview questions
.net caching interview questions
.net oops interview questions
Sharepoint interview questions
Jquery interview questions
Silverlight interview questions
Linq interview questions
Wwf interview questions
Java interview questions
Sql server interview questions
Ssis interview questions
Ssrs interview questions
Data warehousing interview questions
Data mining interview questions
Oracle interview questions
Php interview questions
Design patterns interview questions
Uml interview questions
Mcpd dumps
Pmp practice tests

This site is best viewed with Internet Explorer 7.0 or higher, Firefox 2.0 or higher, Chrome at a minimum screen resolution of 1024x768.
A complete solution to interview questions
free matrimonial website      
web hosting plans |  compare vps hosting plans |  Compare dedicated hosting plans |  Compare linux hosting plans |  Compare cloud hosting plans |  Compare windows hosting plans | 
Hosting reviews |  GoDaddy reviews | 
Support Wikipedia