How does Garbage collector(GC) works in .net

Answer Posted / pradip kumar

Basically GC.Collect will work only if the memeory space is
less then required space.

You can force it to run by System.GC.Collect();

How it works :
Through 'Genaration Number' . CLR assigned this number for
each object so that GC can identify which one to be removed.
It can be 0,1,2 based upoon the
old/new/referenced/dereferenced criteria.
To check the space before and after GC.Collect() method use
GC.GetTotalMemory(true) method.


Regards,
Pradip kr Sen
Hyderabad

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What methods are fired during the page load? Init()

520


Explain the different types of assemblies?

529


Explain what are webservices?

547


What is the use of execute non query in asp.net?

483


how to write html code with ssl

1527






What is the difference between Hash table and Array list?

375


What is the most appropriate lifetime for a database connection/orm context in an asp.net mvc application? : Asp.Net MVC

535


What is the difference between asp.net mvc and asp.net webforms? : asp.net mvc

543


What are different types of api?

533


if i wanna deploy my asp.net project to the production server and situation is that i m still not compiled my project i have as-is on my development side now on production server we dont have a visual studio now what kind of settings i need to be to do in webconfig /machine.config file to deploy my project and in iis too....

1604


How to display validation messages in one control?

550


Explain the disadvantages of viewstate?

571


What is viewstate in asp net with example?

525


Explain the differences between clr & cts?

564


What is viewstate? In which event of the page life cycle, is the viewstate available?

605