Hi,
I am having some memory issues on a RTF editor user control that uses an UltraToolBarManager for toolbars.
It seemed that the toolbar was locking the usercontrol and the form that contains it.
I tried removing the toolbars and it disposes correctly but i would like to use so we can use the customization and app stylist.
Next tried to dispose every tool inside the toolbar and the toolbar itself. Now it doesn't locks the whole form, only the usercontrol but the problem persists as the rtfeditor is huge in memory and keeps locked.
Any guesses?
Thanks.
aralmo,
Thank you for providing the screen shot. This shows that the UltraToolbarsManager is being held onto by a toolbar but doesn't tell what is holding a reference to the toolbar. To look into this we need more details on how you are creating the UltraToolbarsManager and/or the toolbar, what you are trying to dispose of it, and what references your application may be holding on to. Ideally to look into this it would be best if you could provide a sample that we could use for debugging.
Let me know if you have any questions with this matter.
Hi, thanks for the reply i have a support ticket on this matter that was closed yesterday but i couldn't try if its really solved.
I will test the solution proposed this weekend and add some feedback to the ticket.
Aridane Álamo.
Hello,
The suggestion in case CAS-79826-LNJKQ9 was to call Dispose on forms shown with ShowDialog so that resources are cleaned up. This is necessary because when you call ShowDialog the form isn't automatically disposed like it is when you call Show.
Hi Alan,
Actually in the meantime I called the dispose when form closed event which is basically the same trick.. thanks for replying as now I'm more confident with the fix which I did.
Regards.
Hasan,
It would be safer to dispose the form where it was created as the form itself when shown as a dialog has no way to know if that dialog will be shown twice. I believe that your approach will work as long as you don't keep and instance of the form and attempt to show the dialog a second time.
We had a similar issue (possibly the same) and it appears that one of the Ultra Toolbars components is hooking the system preferences event which is only released when you exit the application.
A little background: we have a toolbars manager on a base form that all forms inherit from. From memory, I believe what was happening is that when we dispose the form, the manager was being disposed but the toolbars/ribbon it was managing is not being disposed and it was this/these that were hooked by the event. This non-disposal may be by design, as these may be shared by many managers??
We have the following code which fixes it (apologies, but I cannot remember exactly which part does it). My best guess is one/all of these. From the comment (see full code below), it appears to be related to the ribbon:
this.FormToolbar.Ribbon.Dispose();this.FormToolbar.Toolbars.Dispose();this.FormToolbar.EventManager.AllEventsEnabled = false;
This is the whole dispose we have in our base form that our other forms inherit from but might get you on the right track. Not sure how much of it was required as it takes ages to memory profile each in isolation but it fixed the leak for us, in any case.
protected override void Dispose(bool isDisposing) { try { if ((isDisposing)) { //This code fixes a bug in Infragistics Ultra Toolbar which leaks memory //due to hooking the ribbon up to a system event (user preferences changed) this.Form_Fill_Panel_Toolbars_Dock_Area_Left.ToolbarsManager = null; this.Form_Fill_Panel_Toolbars_Dock_Area_Right.ToolbarsManager = null; this.Form_Fill_Panel_Toolbars_Dock_Area_Top.ToolbarsManager = null; this.Form_Fill_Panel_Toolbars_Dock_Area_Bottom.ToolbarsManager = null; if ((this.FormToolbar != null)) { this.FormToolbar.EventManager.AllEventsEnabled = false; this.FormToolbar.DockWithinContainer = null; this.FormToolbar.Site = null; this.FormToolbar.Ribbon.Dispose(); this.FormToolbar.Toolbars.Dispose(); if ((this.FormToolbar.Appearance.ImageBackground != null)) { this.FormToolbar.Appearance.ImageBackground.Dispose(); this.FormToolbar.Appearance.ImageBackground = null; } this.FormToolbar.Dispose(); this.FormToolbar = null; } if ((components != null)) { components.Dispose(); } } } finally { base.Dispose(isDisposing); } }
My expectation is that if the form is disposed that the components on the form will be disposed including its toolbars and tools. If this isn't happening we would need a sample to look into why it may not be happening in your specific case.