Я заметил утечку памяти в моем приложении Compact Framework 3.5, и, думаю, я заметил, почему: компоненты никогда не добавляются в поле IContainer components
моей формы.Почему Visual Studio 2008 не добавляет каждый компонент, и есть ли способ это исправить?
//Form overrides dispose to clean up the component list.
[System.Diagnostics.DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
try {
if (disposing && components != null) {
// Components is disposed... but nothing was ever added to it!!!
components.Dispose();
}
} finally {
base.Dispose(disposing);
}
}
//Required by the Windows Form Designer
private System.ComponentModel.IContainer components;
//NOTE: The following procedure is required by the Windows Form Designer
//It can be modified using the Windows Form Designer.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.lblName = new System.Windows.Forms.Label();
this.butNext = new System.Windows.Forms.Button();
this.butPrev = new System.Windows.Forms.Button();
this.butClose = new System.Windows.Forms.Button();
this.butMore = new System.Windows.Forms.Button();
this.SuspendLayout();
//
//lblName
//
this.lblName.Font = new System.Drawing.Font("Tahoma", 12f, System.Drawing.FontStyle.Bold);
this.lblName.Location = new System.Drawing.Point(6, 38);
this.lblName.Name = "lblName";
this.lblName.Size = new System.Drawing.Size(373, 22);
this.lblName.Tag = "Estimated Speed ({0})";
this.lblName.Text = "Test";
// ... SNIP ...
}