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.
Vince McDonald"] 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.
I'm not sure I'm following you with regards to disposing controls in version 2009 and earlier. I believe the problem is not that because dispose is not being called, it's the fact that the memory allocation is not being collected even when the control has been disposed because a reference to it by the theming mechanism is not being released .
How do you release these references to the theming mechanism in version 9.2 and earlier?
Explicit 'Dispose' call doesn't work in my case. I override 'Dispose' method in the form which keeps a reference to an UltraWebGrid object:
public override void Dispose() { base.Dispose();
uwg.Dispose(); }
The reference seems to be still kept by the ScriptManager (as it can be seen in MemProfiler). I'm using UltraWebGrid 8.2. What shall I do to solve the problem?