C# 在windows窗体应用程序中查找内存泄漏的最佳方法是什么?

C# 在windows窗体应用程序中查找内存泄漏的最佳方法是什么?,c#,memory-leaks,bindingsource,C#,Memory Leaks,Bindingsource,我正在使用带有绑定源的windows窗体应用程序。我以InitializeComponenet()方法的形式初始化了绑定源代码,如下所示。我能知道下面的代码是正确的吗 private System.Windows.Forms.BindingSource bindingSource1; private void InitializeComponent() { this.bindingSource1 = new System.Windows.Forms.BindingSource(this.comp

我正在使用带有绑定源的windows窗体应用程序。我以InitializeComponenet()方法的形式初始化了绑定源代码,如下所示。我能知道下面的代码是正确的吗

private System.Windows.Forms.BindingSource bindingSource1;
private void InitializeComponent()
{
this.bindingSource1 = new System.Windows.Forms.BindingSource(this.components);;
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).BeginInit();
this.SuspendLayout();
this.bindingSource1.DataSource = typeof(WindowsFormsApplication2.Class1);

control.DataSource = this.bindingSource1;
((System.ComponentModel.ISupportInitialize)(this.bindingSource1)).EndInit();
this.ResumeLayout(false);
}

在designer中进行任何更改,然后运行示例时,VisualStudio将进入无响应状态。因此,我怀疑控件中存在内存泄漏问题,那么如何才能找到内存泄漏问题或visual studio未响应问题?

使用内存探查器。就这么简单。VS有一个。然后总是有memprofiler

这是找到内存泄漏并对其进行分析的唯一方法。

“无响应”与内存泄漏无关。