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.
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.
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?
This should be by design. It generates by the .Net framework. Also it handles by the .Net framework.
Hope it helps.
Life is not so easy.......
Sorry, I dont follow. What is by design? The bindingnavigator being linked to these event handlers?
Do I need to somehow release it from these event handlers? And if so, how?