System.ComponentModel.EventHandlerList undisposed

Use this forum for questions on how to use .NET Memory Profiler and how to analyse memory usage.
Post Reply
lizhou
Posts: 2
Joined: Fri Jan 05, 2007 8:36 pm

System.ComponentModel.EventHandlerList undisposed

Post by lizhou » Fri Jan 05, 2007 8:44 pm

I am trying to profile my ASP.Net application written in VB.Net

The top undisposed instance is always EventHandlerList.
To do a simple test, I have a blank form with a buton control, in the code behind, I have some code in button click event handler.

Each refeshing of the page will create more undisposed EventHandlerList instance. Is this something I should be worried about? I appreciate anyone who can give some inside about this issue. Thanks

Here are part of the tracktraces:

Control.get_Events()
Button.add_Click(EventHandler)
WebUserControl1.InitializeComponent()
WebUserControl1.OnInit(EventArgs)
Control.InitRecursive(Control)
Control.InitRecursive(Control)
Control.InitRecursive(Control)
Page.ProcessRequestMain()
Page.ProcessRequest()
Page.ProcessRequest(HttpContext)
HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
HttpApplication.ExecuteStep(HttpApplication.IExecutionStep, bool&)
HttpApplication.ResumeSteps(Exception)
HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext, AsyncCallback, object)
HttpRuntime.ProcessRequestInternal(HttpWorkerRequest)
HttpRuntime.ProcessRequestNow(HttpWorkerRequest)
HttpRuntime.ProcessRequest(HttpWorkerRequest)
ISAPIRuntime.ProcessRequest(IntPtr, int)

Control.get_Events()
Control.add_Load(EventHandler)
WebForm1.InitializeComponent()
WebForm1.OnInit(EventArgs)
Control.InitRecursive(Control)
Page.ProcessRequestMain()
Page.ProcessRequest()
Page.ProcessRequest(HttpContext)
HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
HttpApplication.ExecuteStep(HttpApplication.IExecutionStep, bool&)
HttpApplication.ResumeSteps(Exception)
HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext, AsyncCallback, object)
HttpRuntime.ProcessRequestInternal(HttpWorkerRequest)
HttpRuntime.ProcessRequestNow(HttpWorkerRequest)
HttpRuntime.ProcessRequest(HttpWorkerRequest)
ISAPIRuntime.ProcessRequest(IntPtr, int)

Andreas Suurkuusk
Posts: 1029
Joined: Wed Mar 02, 2005 7:53 pm

Post by Andreas Suurkuusk » Mon Jan 08, 2007 3:28 pm

Hi,

No, this is not something you normally need to worry about. The Dispose method of EventHandlerList just sets an internal reference field to null. Since the EventHandlerList instance is classified as undisposed it has been garbage collected, and it doesn't matter whether the field is set to null or not. The EventHandlerList class does not contain a finalizer, so no performance penalty is caused by finalization.

Calling Dispose on EventHandlerList is only meaningful if you want to clear the list and intend to keep it for later use. However I think it would have been a better idea to not make EventHandlerList disposable, and add a Clear method instead.
Best regards,

Andreas Suurkuusk
SciTech Software AB

lizhou
Posts: 2
Joined: Fri Jan 05, 2007 8:36 pm

Post by lizhou » Mon Jan 08, 2007 4:17 pm

Thank you very much for your reply

Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests