Garbage Collection in ASP.NET

I

IDoNothing

How does garbage collection work for custom objects
instantiated during a Page_Load or during some other
processing of an ASP.NET page?

Are objects garbage-collected in the same manner using
generations 0, 1, 2, the finalization list and the
freachable queue? Does this apply for the Page object as
well?
 
A

Alvin Bruney

Yes, the qualifying condition is that these objects must be managed
resources. You are responsible for freeing unmanaged resources. It is
theoretically possible to have a garbage collection at every postback if
there is sufficient memory pressure because of the stateless nature of the
web. When a page is torn down, no references exist to local objects and
unpooled resources so collection is entirely at the discretion of the
runtime. This would not apply to objects with roots for example global
objects. What problems are you experiencing?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top