1

Once a controller object is created when does it become available for garbage collection?

2
  • 1
    Just curious: why do you care about this? Commented Jan 12, 2009 at 12:23
  • Just curious about how its all put together so that I wont run into any memory issues. Commented Jan 12, 2009 at 18:07

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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
@Eilon ... many thanks for the heads-up on my post - I will correct it asap :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.