Memory leaks when using System.Windows.Forms #12096
Labels
📭 waiting-author-feedback
The team requires more information from the author
tenet-performance
Improve performance, flag performance regressions across core releases
Milestone
.NET version
.NET 8 (8.0.8)
Did it work in .NET Framework?
Not tested/verified
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
Private bytes of the .NET 8 Windows Form application keeps increasing, when we open and close a Form.
The steps to reproduce section has details on how to reproduce it faster in a simpler way.
I used memprofiler to confirm that there are no leaks in the source code I have used. Memprofiler mentioned that there are increase in the types of object as mentioned in the below image.
Note: We are calling
GC.Collect()
andGC.WaitForPendingFinalizer()
at regular interval and still the private bytes of the application keeps increasing.Steps to reproduce
WinFormsApp1.zip
The application is doing the following:
Form2
that has checkbox, combobox and textbox controls (all from System.Windows.Forms namespace).Form2
has hooked onto Load event in which it creates a Timer which is configured to call a function in one sec.Form1
that has a button.Form2
, calls ShowDialog and disposes the instance when it is done.So, clicking on the button will continuously creates and closes new Window Form.
By monitoring Private Bytes of the application, we can see that memory of the application keeps increasing.
The text was updated successfully, but these errors were encountered: