I have a C # WinForm dialog box that contains a custom table control with rows and cells, which are also custom controls. After closing (without hiding) this dialog, I have a memory leak (and this is confirmed by the .NET memory profiler).
From the information I get from the profiler, I think he is dealing with the removal of these controls, but I'm not sure how to fix it.
In a table control, I have a list of rows:
private readonly List<CustomRow> _rows = new List<CustomRow>();
In each row, I have a list of cells:
List<CustomCell> _cells = new List<CustomCell>();
To date, disposal in the controls has been done using automatic code in the designer.cs file:
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
, .cs - , , :
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
, ? ( ?)