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
140
Ribbon performance and memory leak with theme
posted

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.