About Garbage Collector?

Answers were Sorted based on User's Feedback



About Garbage Collector?..

Answer / sayeed

Garbage collection is an in deterministic process Associated
with CLR. It is used to release the managed free Objects
that are no more refrenced.
But there might be scenarios in which we need to release
certain resources held by an object (like a database
connection) once the object is no longer in use.

We have destructors in C#.C# destructors are nothing but
finalize methods in disguise, with a call to base class's
finalize method.

As we know, finalize method is called during garbage
collection by garbage collector. Hence, we cannot rely only
on C# destructors to explicitly release resources as
finalize methods on objects may never be called altogether
(if the program terminates abnormally) or might be called
only when the program terminates (in a normal way).

Hence it is always a good practice to implement IDisposable
interface in such cases and to write code to release
resources explicitly in the Dispose() method.In that case we
have to use GC.SuppressFinalize() method.

Is This Answer Correct ?    2 Yes 0 No

About Garbage Collector?..

Answer / seshu

garbage collection is a form of automatic memory management.
The garbage collector attempts to reclaim garbage or memory
used by objects that will never be accessed or mutated again
by the application.

Is This Answer Correct ?    0 Yes 0 No

About Garbage Collector?..

Answer / sivaprasad

i)GarbageCollector will take care about Automatic Memory
Management it will mark the objects which has Referrence
Count is Zero.
ii)One Background Thread running in the Application with
Normal Priority And Marking The Objects Which has Referrence
Count is Zero.when there is no Applications Threads Are
Running it will Take High Priority.
iii)And this Garbage Collector Will Take Care About
"Circularreferrences"(means One Pair Of Objects Referring To
Each Other)

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

how to debug web services on consumer side?

0 Answers   HCL,


What are tuples?

0 Answers  


How does a content page different from a master page?

0 Answers   MindCracker,


Why mvc is faster than asp.net? : Asp.Net MVC

0 Answers  


How to create a db connection at one place/page so that we can use that connection for all pages/forms/windows.what r the steps ned to be performed if question not clear,let me know

0 Answers  






what is view stat? how it is use.

3 Answers   TCS,


what is command line compiler.what are the steps and how it is related to debugging.

0 Answers  


Where is session cookies stored?

0 Answers  


What r the asp.net list controls and difference between them?

0 Answers  


What is an example of an application service provider?

0 Answers  


Tell something about state management in asp.net?

3 Answers   Accenture,


Why mvc is better than asp.net? : Asp.Net MVC

0 Answers  


Categories