G
Guest
Hey guys,
We have, a windows form application in VB.NET.
The way this application is structured is, there’s a MasterForm which
contains a Main menu and acts as the mdi parent to around 20 windows forms.
We have a BaseForm with some controls on it inherited by 20 other forms.
The problem we are facing is, as we work on the application, as new
instances of the forms are created, the memory used by the application keep
on increasing (Memory leak happens).
We have even run QTP scripts and observed the Memory usage on TaskBar. It
just keeps on increasing consistently.
On some of the forms we have like around 30 labels and equal number of
textboxes, with datagrid.
Here’s the code being used to display a form and close the present one:
Dim lForm As System.Windows.Forms.Form
‘The type associated with that particular form is returned from the main
assembly (windows application)
Dim lType As Type = AssemblyHelper.FindType(formName)
Try
If Not lType Is Nothing Then
lForm = CType(Activator.CreateInstance(lType),
System.Windows.Forms.Form)
lForm.MdiParent = Me.MdiParent
lForm.Show()
Me.Close()
End If
Catch ex As Exception
Throw ex
End Try
My questions are:
1. Is it a known issue with .NET framework 1.1 SP1?
2. Is there a way to overcome the memory leak occurring?
3. When a form gets disposed, all the objects created including controls, do
they get disposed as well?
I have searched google groups and MSDN groups and found so many interesting
articles, but couldn’t find a solution to the problem.
Any help or suggestion is highly appreciated.
Thanks,
Vinay Kant
We have, a windows form application in VB.NET.
The way this application is structured is, there’s a MasterForm which
contains a Main menu and acts as the mdi parent to around 20 windows forms.
We have a BaseForm with some controls on it inherited by 20 other forms.
The problem we are facing is, as we work on the application, as new
instances of the forms are created, the memory used by the application keep
on increasing (Memory leak happens).
We have even run QTP scripts and observed the Memory usage on TaskBar. It
just keeps on increasing consistently.
On some of the forms we have like around 30 labels and equal number of
textboxes, with datagrid.
Here’s the code being used to display a form and close the present one:
Dim lForm As System.Windows.Forms.Form
‘The type associated with that particular form is returned from the main
assembly (windows application)
Dim lType As Type = AssemblyHelper.FindType(formName)
Try
If Not lType Is Nothing Then
lForm = CType(Activator.CreateInstance(lType),
System.Windows.Forms.Form)
lForm.MdiParent = Me.MdiParent
lForm.Show()
Me.Close()
End If
Catch ex As Exception
Throw ex
End Try
My questions are:
1. Is it a known issue with .NET framework 1.1 SP1?
2. Is there a way to overcome the memory leak occurring?
3. When a form gets disposed, all the objects created including controls, do
they get disposed as well?
I have searched google groups and MSDN groups and found so many interesting
articles, but couldn’t find a solution to the problem.
Any help or suggestion is highly appreciated.
Thanks,
Vinay Kant