本文介绍了Windows.forms .net 2.0的内存泄漏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我用c#而不是c ++编码,所以我有内存泄漏;).我试图对其进行分析,但是现在我陷入了困境.内存分析器有3种泄漏:

1:
-> DropTarget内存泄漏
我在Google上找到了解决方案.每个具有AllowDrop属性设置为"true"的控件.会出问题.我添加了代码以将它们设置为"false". ->问题解决了.

2:
-> OleCallback泄漏
由于OleCallback,richtextbox保持活动状态.我使用的丰富文本框是从标准的文本框派生的.但是我看不到应该影响它的代码.有什么主意吗?

3:
-> UserPreferenceChangedEventHandler
由于上面的引用,标准DataGridView保持活动状态.我从来没有在我的代码及其标准控件中连接此信号.

我仅在调试模式下使用了内存探查器.是的,我还具有编辑并继续"功能.内存泄漏 :).

请帮助;)

Since i code c# instead of c++ i have memory leaks ;). I tried to analyse it, but now i am stucked. The memory profiler had 3 kind of leaks:

1:
-> DropTarget memory leak
I have found a solution on google. Each control that has the AllowDrop property set to "true" makes problems. I added code to set them to "false" -> problem solved. Is this the way it should be?

2:
-> OleCallback leak
The richtextbox stays alive because of the OleCallback. The richtextbox i use is derived from the standard one. But i can't see code that should affect it. Any idea?

3:
-> UserPreferenceChangedEventHandler
The standard DataGridView stays alive because of the above reference. I never connect this signal in my code, and its the standard control.

I used memory profiler only in Debug mode.... and yes i also had the "edit and continue" memory leak :).

Please help ;)

推荐答案


这篇关于Windows.forms .net 2.0的内存泄漏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 20:01
查看更多