In a test app, I had a small (two context tab) ribbon:
<ig:XamRibbon HorizontalAlignment="Left" Name="xamRibbon1" ApplicationMenuMode="Office2010" VerticalAlignment="Top" > <ig:XamRibbon.Tabs> </ig:XamRibbon.Tabs> <ig:XamRibbon.ContextualTabs> <ig:XamRibbonContextualTab Content="Test1" BaseBackColor="#00EFDA12" IsVisible="True"> <ig:XamRibbonContextualTab.Tabs> <ig:XamRibbonTabItem Header="Tab1" Name="Tab1"> <ig:XamRibbonGroup Caption="Group 1"> <ig:ButtonTool Caption="Button 2" /> </ig:XamRibbonGroup> <ig:XamRibbonGroup Caption="Group 2"> <ig:ButtonTool Caption="Button 4" /> </ig:XamRibbonGroup> </ig:XamRibbonTabItem> <ig:XamRibbonTabItem Header="Tab2" Name="Tab2"> <ig:XamRibbonGroup Caption="Group 3"> <ig:ButtonTool Caption="Button 6" /> </ig:XamRibbonGroup> <ig:XamRibbonGroup Caption="Group 4"> <ig:ButtonTool Caption="Button 8" /> </ig:XamRibbonGroup> </ig:XamRibbonTabItem> </ig:XamRibbonContextualTab.Tabs> </ig:XamRibbonContextualTab> </ig:XamRibbon.ContextualTabs> </ig:XamRibbon>
I then had a background thread switching between Tab1 and Tab2 1000 times (500 each) with a 10ms delay. The switching took just over 10 seconds, with a nett memory rise of 112K (mainly occurring over the initial iterations), as expected.
However, if I now add in the Office2010 Blue theme:
<UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="Resources/Office2010Blue.xamRibbonGeneric.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </UserControl.Resources>
(having added the RibbonBrushes, RibbonGeneric and RibbonPArtStyles files) and re-run the timings, I see a duration of 12 seconds, with the UI refresh rate slowing down during the iterations. Checking memory, there has been a nett gain of 10.2 MB, linearly increasing over the iterations.
This leads me to suspect that this ribbon theme is causing a memory leak.
I have reproduced this on 11.2 and 12.1.
For the moment, I can probably avoid using this theme, but it may be worth looking into.
Thanks.
Additional update: I was playing around with a custom tool/toolcontrol for the ribbon. I observed that if there was 1 instance of my custom tool in the ribbon, when the ribbon was created my ToolControl was created twice. ToolControl was disposed on application shutdown.
If I added in the Office2010 theme resource, my custom control was created twice every time I switched to that tab, and there was no dispose until shutdown.
So the above memory leak could be caused by multiple creations of the background ToolControl instances.
Hi,
I was able to partially reproduce your issue. More specifically - the memory leak when applying a new theme. So, when you apply a new theme, new ToolControls are generated but the old ones are not being correctly released and garbage-collected. I logged the issue with our development and I'll have our Developer Support staff open a case for you so you are notified when a fix is available.
However, I could not reproduce the issue where new controls are generated every time you switch a tab. In my case if you have multiple tabs and you applied a new theme, controls would be generated only the first time you switch to a given tab (for the tools in that tab).
Thanks for reporting this issue!
HI,
This issue has been resolved with the latest service release.
Sincerely,
Matt
Developer Suopport Engineer
Please let me know if you need further assistance regarding this case.
Developer Support Engineer