简体   繁体   中英

what is the best way to found memory leaks in windows form application?

I am using windows form application with binding source. I have initialized the binding source as below code in form InitializeComponenet() method. Can I know the below code is correct?

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);
}

When making any changes in designer, then run the sample, the visual studio goes to Not Responding state. So I suspect some memory leak problem in the control, so how can i found the memory leak problem or visual studio not responding problem?

Using a memory profiler. Simple as that. VS has one. And then there is always memprofiler.

This is about the only way to find a memory leak and analyze it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM