Memory Leak

Emily Fong

We have a window application which developing with RadForm and all the radcontrol (Q2 2011 version). We found that after we close each form, the memory usage in client machine does not release. We used the JustTrace tool / Net Performance Tool and found that some of the Telerik control was disposed but not in GC.

We created a testing application to compare the memory usage for RadForm and Window Form. In the testing application, we have one Window Forms with menu control, one RadForm with RadGridView and one Window Form with RadGridView. When we run the application, we keep open and close the RadForm 10 times. Then, we found the memory usage is increase around 5,000k. However, if we do the same on Window Form, the memory usage is only increase 500k.

So, how can we release the memory after we close the forms ( before the application was not closed)?

Code for the Window Form with menu control:

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _

Partial Class Form1

Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.

<System.Diagnostics.DebuggerNonUserCode()> _

Protected Overrides Sub Dispose(ByVal disposing As Boolean)

Try

If disposing AndAlso components IsNot Nothing Then

components.Dispose()

End If

Finally

MyBase.Dispose(disposing)

End Try

End Sub

'Required by the Windows Form Designer

Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer

Peter

I want to share with you that RadForm/Form is a disposable object and you have to call its Dispose method explicitly, for example:

using(Form2 newform = newForm2())

{

newform.ShowDialog();

}

I also want to share with you that the Garbage Collector releases the instance of RadControls later than it frees less complex controls. The reason is that RadControls is a second generation Garbage Collector object. If you want to release the memory instantly after the form is closed, you should call the GC.Collect method manually. Consider the code snippet below:

Emily Fong

However, we found any memory leaks problem. Please help to handle it.
In a Radform, we have a RadGridView with datetimecolumn. We click the calendar in grid column to select a date and close the form. Then, in .NET Memory Profiler, we found that there is a RadCalendar control is directly rooted by an EventHandler and that Eventhandler has not been properly removed.
So, how can we remove that EventHandler since that RadCalendar is created by RadGridView control?

Peter

Despite our efforts, our tests did not show memory leaks in a similar scenario and I was not able to identify a memory leak in our test application. Therefore, could you please provide me with your application and exact steps to reproduce the issue in it, so that we can locate it and address it further?

Thank you for your time and cooperation. Please note that you have to open a new support ticket in order to be able to attach files.

Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.