We have a memory leak issue due to controls being retained by UltraToolbarsManager.
Here is the architecture we have: Control1 has a UltraToolbarsManager. Control1 creates several Control2 objects in tabs. Control2 objects have also UltraGrids. We use the UltraToolbarsManager of Control1 to set the contextMenuUltra's of the UltraGrids of the Control2 objects.
As we close the Control2 objects via tabs, we realize that those Control2 objects are not disposed off the memory entirely, because they are retained by Control1.UltraToolbarsManager.contextMenuUltras.
In order to overcome this issue, we have tried Control1.UltraToolbarsManager.SetContextMenuUltra(UltraGridXYZ, null). However, we realized that even though UltraGridXYZ was disposed, the Control2 object was still retained in the memory, via UltraToolbarsManager.contextMenuUltras.val[]..._target.
Is there a way to detach the Control2 object from the UltraToolbarsManager at the end of its life cycle so that it doesn't remain in the memory? Or shall we maintain a separate UltraToolbarsManager for each Control2 object, that we create?
Hi Burak,
If I am understanding your description correctly, it seems that Control1 is retaining references to the Control2 objects, which prevents the garbage collector from releasing them and their associated controls. You should be able to release the memory by calling Dispose on the Control2 objects once you are done with them.
Please try this out and let me know whether it works.
Thank you for your response, Mike.
Control2.Dispose is already called.
I will try to explain it as simple as I can.
Control1 has a UltraToolbarsManager object.
Control2 has an UltraGrid object and we make the following association:
Control1.UltraToolbarsManager.SetContextMenuUltra(Control2.UltraGrid, "someContextMenuUltra")
At the dispose of Control2, we do the following disassociation:
Control1.UltraToolbarsManager.SetContextMenuUltra(Control2.UltraGrid, null)
Nevertheless, we see in the memory profiler that Control1.UltraToolbarsManager still has a reference to Control2.UltraGrid and therefore, Control2 is retained in the memory.
When a user starts and closes several Control2 objects throughout the day(s), this causes a memory problem in our application.
Is there a way to completely break that reference from Control1.UltraToolbarsManager to Control2.UltraGrid?