Explain garbage collection?
Submitted by: AdministratorThe automatic memory management scheme employed by the .NET Framework (CLR) is called garbage collection.
Unused memory is automatically reclaimed by garbage collection without interaction with the application
The garbage collector is a low-priority thread that always runs in the background of the application under normal circumstances. It operates when processor time is not consumed by more important tasks. When memory becomes limited, however, the garbage collector thread moves up in priority. Memory is reclaimed at a more rapid pace until it is no longer limited, at which point the priority of garbage collection is again lowered.
in c# memory is divided in five blocks stack,heap,Global,static,& the code block..all the objects created in the heap block(the total size of heap block is 64 mb)whn the heap block is about to full the gc(garbaze collector)automatically invokes & it deletes all those objects which are not in use or not pointing anywhere..in other words we can say dat the GC free the memory by deleting the unused objects or references.
a user never know when GC runs or invokes becz it runs automatically when d heap memory is going to full..
GC takes cares of heap block not stack block so it is good for the user to create any number of objects without care of memory. c# launches new features of garbage collection before c# (in any languages like c or c#)whn a user create a object it thinks first about memory and after dat its user responsibility to free d memory bt this is not d case in c# bcoz GC automatically takes cares of MEMORY MANAGMENT
Submitted by: Administrator
Unused memory is automatically reclaimed by garbage collection without interaction with the application
The garbage collector is a low-priority thread that always runs in the background of the application under normal circumstances. It operates when processor time is not consumed by more important tasks. When memory becomes limited, however, the garbage collector thread moves up in priority. Memory is reclaimed at a more rapid pace until it is no longer limited, at which point the priority of garbage collection is again lowered.
in c# memory is divided in five blocks stack,heap,Global,static,& the code block..all the objects created in the heap block(the total size of heap block is 64 mb)whn the heap block is about to full the gc(garbaze collector)automatically invokes & it deletes all those objects which are not in use or not pointing anywhere..in other words we can say dat the GC free the memory by deleting the unused objects or references.
a user never know when GC runs or invokes becz it runs automatically when d heap memory is going to full..
GC takes cares of heap block not stack block so it is good for the user to create any number of objects without care of memory. c# launches new features of garbage collection before c# (in any languages like c or c#)whn a user create a object it thinks first about memory and after dat its user responsibility to free d memory bt this is not d case in c# bcoz GC automatically takes cares of MEMORY MANAGMENT
Submitted by: Administrator
Read Online Microsoft.NET Job Interview Questions And Answers
Top Microsoft.NET Questions
☺ | What is IL and C#? |
☺ | Explain CLR, CTS and CLS? |
☺ | What is satelite assembly? |
☺ | How to stop a thread? |
☺ | Explain garbage collection? |
Top Dot Net Technologies Categories
☺ | MSF Interview Questions. |
☺ | .Net Architecture Interview Questions. |
☺ | ASP.Net MVC Interview Questions. |
☺ | Entity Framework Interview Questions. |
☺ | C# (Sharp) Programming Language Interview Questions. |