Once a controller object is created when does it become available for garbage collection?
-
1Just curious: why do you care about this?Matt Hinze– Matt Hinze2009-01-12 12:23:18 +00:00Commented Jan 12, 2009 at 12:23
-
Just curious about how its all put together so that I wont run into any memory issues.zsharp– zsharp2009-01-12 18:07:11 +00:00Commented Jan 12, 2009 at 18:07
Add a comment
|
1 Answer
Usually when no active reference to this object is detected. This is handled internally by the garbage collector and so you do not have to take care about it.
So, having this in mind, after the moment Page_Unload method is called which is hosting the controller, the garbage collector gets notified that the controller object is ready for disposal.
2 Comments
Eilon
The part about not having active references is not really true at all. The CLR uses reachability to determine the need garbage collection, not reference counting. See Raymond Chen's blog for details: blogs.msdn.com/b/oldnewthing/archive/2010/08/10/10048149.aspx
Dimi Takis
@Eilon ... many thanks for the heads-up on my post - I will correct it asap :)