I have a simple form (MainForm) that opens another form (SubForm) which has a ToolStrip on it.
There is nothing else on the called form. The calling form only has a button.
The memory of the form that is called is never reclaimed because there is an eventhandler for SystemEvents.UserPreferenceChanged. I read that this is an issue that got fixed in .NET 3.5.1.
[EDIT The application runs on 3.5.1 so either it is not realy fixed or I do something different]
Can I do something so that the GC can reclaim the memory of subform?
As soon as I remove the ToolStrip, the form subform can be garbage collected again.
MainForm
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
SubForm subForm = new SubForm();
subForm.ShowDialog();
}
}
SubForm
public partial class SubForm : Form
{
public SubForm()
{
InitializeComponent();
}
}
Instance Retention Graph with Toolstrip
Large Version