I've noticed that I have this huge memory leak.My app relies heavily on infragistics ui components, and our code createsAnd destroys many UserControls that comprise mostly of UltraTextEditors.After some research I found that the constructor is not called on ANY control that contains an UltraTextEditor (and probably other editors as well).
This seemed so weird to me that I started a new project, that contains a main form, and a single user control, which in turn contains a single UltraTextEditor. I added a destructor to this control, and set it to print a message to the debug console.To the main control I added a single button that creates my user control and looses reference to it, and then a call to GC.Collect();.
If the control contains the UltraTextEditor, the descructor is never called, if I remove the line with "this.controls.add(ultraTextEditor1); " the destructor is called as expected.Why does this happen? Is there some setting I need to know of somewhere that prevents my control from being GCed? Does the UltraTextEditor save a reference to the parent class in some static place that never gets out of scope?
In a previous post in this thread, we confirmed that to apply changes to use a weak event handler model would be a non-trivial implementation.
I'm pleased to announce that we've implemented this change for the release of NetAdvantage for .NET 2010 Volume 1.
Please note that the recommended practice remains to dispose references to your controls yourself, rather than relying on destructors and garbage collection, in any scenario where disposal isn't done for you. Ensuring that your controls are disposed remains the best solution that is available in NetAdvantage for .NET 2009 Volume 2 and older, and will continue to be a best-practice recommendation even after the new version of the toolset containing this change is released.
Thank you all for your input and your patience.
Hi Jasun,
No, there's no way to turn off the theme change hook.
That sounds like something Developer Support needs to look into. Have you submitted this to them?
Thanks for your quick response, Mike,
In my test app, the ultrabutton control has been added to the form's controls collection and does not get garbage collected after the form is closed. Our memory profiling tool indicates that the ThemeChangedDelegate is preventing it from being collected.
This problem only seems to arise when there is an UltraTabbedMdiManager present in the project- at least from my initial testing. It seems to also to be affected by the UseOSThemes property of the controls. the a global setting i can use to disable the theme delegate?
Hi Jason,
jasunbrown said:We're having the same issue. i created a stand alone app that demonstrates the flaw perfectly. The idea of having to explicitly dispose of all of our infragistcs ui controls is insane in a managed environment. Many of our controls are placed on the forms at runtime- so doing this would require code changes to maintain handles to these controls...
You really have to dispose of every control. This is not specific to Infragistics. Every control you place on a form is disposed by the form. As long as you add the control to the form's Controls collection, the form will take care of disposing it for you. You can look at the OnDispose method of the form and see the code that does this.
We're having the same issue. i created a stand alone app that demonstrates the flaw perfectly. The idea of having to explicitly dispose of all of our infragistcs ui controls is insane in a managed environment. Many of our controls are placed on the forms at runtime- so doing this would require code changes to maintain handles to these controls...
has any progress been made on this issue? please let me know if there is a simple infragistics-suggested work around. I am using v9.2. (previously, we were using v7.3, which had the same issue)
Thanks in advance
jason