Garbage Collection in ASP.NET

  • Thread starter Thread starter IDoNothing
  • Start date Start date
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?
 
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?
 
Back
Top