I'm tracking down some memory leaks in our application using ANTS Memory Profiler and in a number of cases the start of the reference chain is Infragistics.Win.UIAutomation.Proxies.FragmentRootUIAProviderProxy -> Infragistics.Win.UltraWinGrid.UltraCombo+UltraComboUiaProviderStub. This is only happening on user controls that contain an UltraCombo and are dynamically added to the form at run-time. I don't doubt that we're doing something wrong, but I'd appreciate any insight as to what these classes do and what we might be doing that's keeping them in memory.
Thanks.
Hi,
Those classes are related to UI Automation. They are really intended to help with CodedUITest support, but they can also be used by accessibility applications to interact with controls in a generic way.
If you are creating the controls in code at run-time, then they won't get disposed unless you explicitly dispose them or they are added to the form (in which case, the form will dispose them when the form itself is disposed). If you are disposing the control and those classes are hanging around, then it may be a bug.
Since you are probably not using UIA, anyway, one easy way to solve the issue would be to simply turn off UIA support. You can do this like so:
Infragistics.Win.UltraControlBase.UIAutomationForCodedUITestingEnabled = false;
You need to do this before the UIA objects are created, though, so I would do it your Main method before the call to Application.Run or maybe in the constructor of your main form before the InitializeComponent call.
That fixed the problem. Thanks.