取消注册BingingNavigator事件 [英] Unregistering BingingNavigator events

查看:90
本文介绍了取消注册BingingNavigator事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试消除C#winforms应用目前存在的内存泄漏.目前,我正在通过使用内存探查器(dotTrace),打开表单,关闭它并转储内存来做到这一点.查看转储,我关注的是传入参考", 据我最近了解到的那样,这阻止了表单从内存中正确卸载.

I'm trying to remove the memory leak(s) my C# winforms app has at the moment. At the moment I'm doing this by using a memory profiler (dotTrace), opening a form, closing it, and dumping the memory. Looking at the dump, I'm focusing on the "Incoming References", as from what I have learned of late, this is preventing the form from unloading from memory properly.

我在这里取得了一些成功-我设法取消了很多活动的注册.它们中的大多数是显而易见的-有什么事件导致了它们的线索,并且对其取消设置就像将匹配的-="标记放入一样容易.调用Dispose方法.

I have had some success here - I have managed to unregister a lot of events. Most of them were kind of obvious - there were clues as to what events was causing them, and unregstering them was as easy as putting a matching "-=" call in the Dispose method.

其他人不是很明显.我在该线程中重点介绍的一个与BindingNavigator相关(我认为).在下图中,您将在dotTrace中看到转储的输出.我选择了按对象传入的引用",并扩展了该节点 我认为与BindingNavigator有关(我已突出显示了可以为我提供线索的部分).

Others are not so obvious. The one I'm focusing on in this thread is (I think) related to the BindingNavigator. In the image below you will see the output from the dump in dotTrace. I have selected the "Incoming References by Objects", and expanded the node that I think is related to the BindingNavigator (I have highlighted the section that gives me a clue to this).

现在,我的问题是,这是什么原因造成的?我看不到绑定导航器针对它发生的任何事件,因此我不确定应该注销哪些事件.

Now, my question is, what is causing this? I cant see any events that the binding navigator has against it, so I'm not sure what events I should be de-registering.

我错过了什么吗?我在正确的轨道上吗?我在误解内存转储吗?

Am I missing something? Am I on the right track? Am I mis-interpreting the memory dump?

推荐答案

这应该是设计使然.它由.Net框架生成.它还由.Net框架处理.

This should be by design. It generates by the .Net framework. Also it handles by the .Net framework.

希望它会有所帮助.


这篇关于取消注册BingingNavigator事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆