Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
215
Critical Error/Memory leak?
posted

I've noticed that I have this huge memory leak.
My app relies heavily on infragistics ui components, and our code creates
And 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?