This is a migrated thread and some comments may be shown as answers.

Virtualization Memory Usage

12 Answers 125 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 07 Dec 2010, 01:59 PM
Hi,

I have implemented column and row virtualization on a grid that is displaying up to a couple of thousand records. The columns defined for the grid include custom image based cell templates, custom filters and custom converters.

I have noticed that when scrolling up and down the grid the memory usage increases constantly and is never released. I had assumed that once a row had been rendered once then the memory would not be hit a second time.

After scrolling up a down the grid once, with only 500 rows, 25 displayed at any one time, the memory usage rises from 180Mb to 445Mb and nothing can be done to free that memory. This is unacceptable behaviour and will grind our clients machines to a halt.

Source for the grid:

<grid:RadGridView x:Name="InstanceGrid" Grid.Row="1" Grid.ColumnSpan="2" Width="1220"
                          ItemsSource="{Binding AllPublicationInstances}" 
                          Filtered="InstanceGrid_Filtered" Grouped="InstanceGrid_Grouped"
                          AutoGenerateColumns="False" GridLinesVisibility="Vertical" MaxHeight="658"
                          FontSize="11" IsFilteringAllowed="True" ShowGroupPanel="True" RowHeight="29" 
                          ShowGroupFooters="False" Padding="0" RowIndicatorVisibility="Collapsed" EnableColumnVirtualization="True" EnableRowVirtualization="True" 
                          CanUserInsertRows="False" IsReadOnly="True" CanUserDeleteRows="False" DataLoadMode="Asynchronous"
                          RowDetailsVisibilityMode="VisibleWhenSelected" ElementExporting="InstanceGrid_ElementExporting"
                          ClipboardCopyMode="Default" ClipboardPasteMode="None" SelectionMode="Extended" SelectionUnit="FullRow" CopyingCellClipboardContent="InstanceGrid_CopyingCellClipboardContent">
  
            <grid:RadGridView.Columns>
                <grid:GridViewSelectColumn UniqueName="SelectRow" IsResizable="False" />
  
                <grid:GridViewDataColumn UniqueName="Read" IsResizable="False" SortMemberPath="IsRead" IsFilterable="True" DataMemberBinding="{Binding IsRead}" ShowDistinctFilters="False">
                    <grid:GridViewDataColumn.FilteringControl>
                        <CommonControls:BooleanFilterControl>
                            <CommonControls:BooleanFilterControl.TrueTitle>
                                <Grid HorizontalAlignment="Stretch" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0"  Margin="5,0,5,0"  Text="Read Items"></TextBlock>
                                    <Image Grid.Column="1"  Source="/Insurer.Analytics.SharedResources;component/Icons/mail_read.png" Height="16" Width="16" Stretch="Fill" />
                                </Grid>
                            </CommonControls:BooleanFilterControl.TrueTitle>
                            <CommonControls:BooleanFilterControl.FalseTitle>
                                <Grid HorizontalAlignment="Stretch" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Margin="5,0,5,0"  Text="Unread Items" Grid.Column="0"></TextBlock>
                                    <Image Grid.Column="1" Source="/Insurer.Analytics.SharedResources;component/Icons/mail_unread.png" Height="16" Width="16" Stretch="Fill" />
                                </Grid>
                            </CommonControls:BooleanFilterControl.FalseTitle>
                        </CommonControls:BooleanFilterControl>
                    </grid:GridViewDataColumn.FilteringControl>
                    <grid:GridViewDataColumn.Header>
                        <Image Source="/Insurer.Analytics.SharedResources;component/Icons/mail_read.png" ToolTipService.ToolTip="Read" Height="16" Width="16" Stretch="Fill" />
                    </grid:GridViewDataColumn.Header>
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding IsRead, Converter={StaticResource ReadUnreadImageConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                    <grid:GridViewDataColumn.GroupHeaderTemplate>
                        <DataTemplate>
                            <Image Source="{Binding Group.Key, Converter={StaticResource ReadUnreadImageConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.GroupHeaderTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewDataColumn UniqueName="Archived" IsResizable="False" IsFilterable="True" DataMemberBinding="{Binding IsArchive}" ShowDistinctFilters="False">
                    <grid:GridViewDataColumn.FilteringControl>
                        <CommonControls:BooleanFilterControl>
                            <CommonControls:BooleanFilterControl.TrueTitle>
                                <Grid HorizontalAlignment="Stretch" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Margin="5,0,5,0" Grid.Column="0"  Text="Archived Items" HorizontalAlignment="Stretch"></TextBlock>
                                    <Image Grid.Column="1"  Source="/Insurer.Analytics.SharedResources;component/Icons/cabinet.png" Opacity="0.4" HorizontalAlignment="Right" Height="16" Width="16" Stretch="Fill"/>
                                </Grid>
                            </CommonControls:BooleanFilterControl.TrueTitle>
                            <CommonControls:BooleanFilterControl.FalseTitle>
                                <Grid HorizontalAlignment="Stretch">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Margin="5,0,5,0" Grid.Column="0"  HorizontalAlignment="Stretch" Text="Non-archived (Active) Items"></TextBlock>
                                    <Image Grid.Column="1"  Source="/Insurer.Analytics.SharedResources;component/Icons/cabinet.png" HorizontalAlignment="Right" Height="16" Width="16" Stretch="Fill"/>
                                </Grid>
                            </CommonControls:BooleanFilterControl.FalseTitle>
                        </CommonControls:BooleanFilterControl>
                    </grid:GridViewDataColumn.FilteringControl>
                    <grid:GridViewDataColumn.Header>
                        <Image Source="/Insurer.Analytics.SharedResources;component/Icons/cabinet.png" ToolTipService.ToolTip="Archived" Height="16" Width="16" Stretch="Fill"/>
                    </grid:GridViewDataColumn.Header>
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="/Insurer.Analytics.SharedResources;component/Icons/cabinet.png" Opacity="{Binding IsArchive, Converter={StaticResource ArchivedImageOpacityConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                    <grid:GridViewDataColumn.GroupHeaderTemplate>
                        <DataTemplate>
                            <Image Source="/Insurer.Analytics.SharedResources;component/Icons/cabinet.png" Opacity="{Binding Group.Key, Converter={StaticResource ArchivedImageOpacityConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.GroupHeaderTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewDataColumn UniqueName="LatestInstance" IsResizable="False" IsFilterable="True" DataMemberBinding="{Binding IsLatestInstance}" ShowDistinctFilters="False">
                    <grid:GridViewDataColumn.FilteringControl>
                        <CommonControls:BooleanFilterControl >
                            <CommonControls:BooleanFilterControl.TrueTitle>
                                <Grid HorizontalAlignment="Stretch" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Margin="5,0,5,0"  Text="Latest Results"></TextBlock>
                                    <Image Grid.Column="1" Source="/Insurer.Analytics.SharedResources;component/Icons/circle_yellow.png" Height="16" Width="16" Stretch="Fill" />
                                </Grid>
                            </CommonControls:BooleanFilterControl.TrueTitle>
                            <CommonControls:BooleanFilterControl.FalseTitle>
                                <Grid HorizontalAlignment="Stretch" >
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="180" />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <TextBlock Grid.Column="0" Margin="5,0,5,0"  Text="Not Latest (Historical) Results"></TextBlock>
                                    <Image Grid.Column="1" Source="/Insurer.Analytics.SharedResources;component/Icons/circle_white.png" Height="16" Width="16" Stretch="Fill" />
                                </Grid>
                            </CommonControls:BooleanFilterControl.FalseTitle>
                        </CommonControls:BooleanFilterControl>
                    </grid:GridViewDataColumn.FilteringControl>
                    <grid:GridViewDataColumn.Header>
                        <Image Source="/Insurer.Analytics.SharedResources;component/Icons/circle_yellow.png" ToolTipService.ToolTip="Latest Instance" Height="16" Width="16" Stretch="Fill" />
                    </grid:GridViewDataColumn.Header>
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <Image Source="{Binding IsLatestInstance, Converter={StaticResource IsLatestImageConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                    <grid:GridViewDataColumn.GroupHeaderTemplate>
                        <DataTemplate>
                            <Image Source="{Binding Group.Key, Converter={StaticResource IsLatestImageConverter}}" Height="16" Width="16" Stretch="Fill" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.GroupHeaderTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewColumn UniqueName="Actions" IsResizable="False" Header="Actions" IsGroupable="False" IsFilterable="False">
                    <grid:GridViewColumn.CellTemplate>
                        <DataTemplate>
                            <telerikRibbonBar:RadRibbonSplitButton Padding="5" FontWeight="Normal" Content="View" CommandParameter="{Binding}" Command="{Binding Value, Source={StaticResource viewCommand}, Converter={StaticResource WeakCommandBindingConverter}}" >
                                <telerikRibbonBar:RadRibbonSplitButton.DropDownContent>
                                    <telerikNavigation:RadContextMenu BorderThickness="0">
                                        <telerikNavigation:RadMenuItem Visibility="{Binding IsRead, Converter={StaticResource InverseVisiblityConverter}}" Header="Mark As Read" CommandParameter="{Binding}" Command="{Binding Value, Source={StaticResource markReadCommand}, Converter={StaticResource WeakCommandBindingConverter}}" />
                                        <telerikNavigation:RadMenuItem Visibility="{Binding IsRead, Converter={StaticResource BoolToVisibilityConverter}}"  Header="Mark As Unread" CommandParameter="{Binding}" Command="{Binding Value, Source={StaticResource markUnreadCommand}, Converter={StaticResource WeakCommandBindingConverter}}" />
                                        <telerikNavigation:RadMenuItem Visibility="{Binding IsArchive, Converter={StaticResource InverseVisiblityConverter}}" Header="Archive" CommandParameter="{Binding}" Command="{Binding Value, Source={StaticResource archiveCommand}, Converter={StaticResource WeakCommandBindingConverter}}" />
                                        <telerikNavigation:RadMenuItem Visibility="{Binding IsArchive, Converter={StaticResource BoolToVisibilityConverter}}" Header="UnArchive" CommandParameter="{Binding}" Command="{Binding Value, Source={StaticResource unArchiveCommand}, Converter={StaticResource WeakCommandBindingConverter}}" />
                                    </telerikNavigation:RadContextMenu>
                                </telerikRibbonBar:RadRibbonSplitButton.DropDownContent>
                            </telerikRibbonBar:RadRibbonSplitButton>
                        </DataTemplate>
                    </grid:GridViewColumn.CellTemplate>
                </grid:GridViewColumn>
  
                <grid:GridViewDataColumn Header="Name" MinWidth="150" DataMemberBinding="{Binding Name}" ShowDistinctFilters="False" MaxWidth="500">
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Name}" ToolTipService.ToolTip="{Binding Name}" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewDataColumn Header="Type" MinWidth="100" DataMemberBinding="{Binding ItemType}" ShowDistinctFilters="True" MaxWidth="300">
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding ItemType}" ToolTipService.ToolTip="{Binding ItemType}" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewDataColumn Header="Category" MinWidth="100" DataMemberBinding="{Binding CategoryName}" ShowDistinctFilters="True" MaxWidth="300">
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding CategoryName}" ToolTipService.ToolTip="{Binding CategoryName}" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                </grid:GridViewDataColumn>
  
                <grid:GridViewDataColumn UniqueName="SummarisedDateColumn" Header="Published Date" MinWidth="150" SortMemberPath="PublishedDate" DataMemberBinding="{Binding SummarisedDate}" Width="150" IsResizable="False" ShowDistinctFilters="False">
                    <grid:GridViewDataColumn.FilteringControl>
                        <CommonControls:DateRangeFilterControl/>
                    </grid:GridViewDataColumn.FilteringControl>
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding PublishedDate}" ToolTipService.ToolTip="{Binding PublishedDate}" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                </grid:GridViewDataColumn>
                <grid:GridViewDataColumn UniqueName="PublishedDateColumn" Header="Published Date" DataMemberBinding="{Binding PublishedDate}" IsVisible="False"/>
  
                <grid:GridViewDataColumn Header="Description" MinWidth="150" DataMemberBinding="{Binding Description}" ShowDistinctFilters="False">
                    <grid:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Description}" ToolTipService.ToolTip="{Binding Description}" />
                        </DataTemplate>
                    </grid:GridViewDataColumn.CellTemplate>
                </grid:GridViewDataColumn>
            </grid:RadGridView.Columns>
        </grid:RadGridView>

12 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 Dec 2010, 03:17 PM
Hello,

 Can you post more info about your grid version?

Best wishes,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 07 Dec 2010, 03:19 PM
Hi Vlad,

We have recently upgraded and are running against Q3 - 2010.3.1110.1040

Regards,
Chris
0
Vlad
Telerik team
answered on 08 Dec 2010, 09:05 AM
Hi,

 Can you comment temporary the template with the RadRibbonSplitButton to see if you have same problems?

Greetings,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Vlad
Telerik team
answered on 08 Dec 2010, 09:15 AM
Hi Chris,

Can you please try also our latest internal build? We've changed the template loading logic in the grid and I believe that you will get better performance and low memory usage.

Kind regards,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 08 Dec 2010, 10:18 AM
Hi Vlad,

Have just commented out the RadRibbonSplitButton and the memory usage does not increase at all when scrolling the grid!

Have just downloaded the latest internal build so will install the binaries and let you know if this issue is resolved with the RadRibbonSplitButton reinstated.

Many Thanx,
Chris
0
Chris
Top achievements
Rank 1
answered on 08 Dec 2010, 10:50 AM
Hi Vlad,

I upgraded to the latest internal build and things have improved dramatically with the RadRibbonSplitButton back in. The memory usage did creep up slightly when scrolling large datasets, but only by around 3-4Mb, so much better than the 200Mb we were seeing before.

Thank you for resolving this so quickly. Will there be an offical service pack release for Q3 at some point, and if so do you have any rough estimates on a release date?

Thanx,
Chris
0
Chris
Top achievements
Rank 1
answered on 08 Dec 2010, 11:01 AM
Hi Vlad,

Although the issue with the memory usage has been resolved, it appears a new issue has been introduced with the GridView. We are using the grid view to display data in other areas with AutoGenerateColumns enabled. These grids are not displaying any data initially since upgrading to the latest internal build. If you scroll up and down then the values are eventually displayed. See the attached screen shots for an example.

The XAML for this grid is shown below:

<grid:RadGridView x:Name="WrappedGridView" Grid.Row="1"
                          ItemsSource="{Binding ItemsSource}"
                          RowIndicatorVisibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top"
                          AutoGenerateColumns="True" ShowGroupPanel="False" ShowColumnFooters="True"
                          EnableColumnVirtualization="True" EnableRowVirtualization="True" DataLoadMode="Asynchronous"
                          ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto"
                          Margin="3,0,3,3" MinColumnWidth="50" MaxColumnWidth="250" ColumnWidth="*"
                          IsReadOnly="True" ElementExporting="WrappedGridView_ElementExporting"
                          ClipboardCopyMode="Header,Default" ClipboardPasteMode="None" SelectionMode="Extended" SelectionUnit="Cell"/>
0
Chris
Top achievements
Rank 1
answered on 08 Dec 2010, 11:06 AM
Vlad,

FYI - Disabling column and row virtualization resolves the missing data issue.

Kind Regards,
Chris
0
Vlad
Telerik team
answered on 08 Dec 2010, 12:30 PM
Hi Chris,

 Indeed we plan to release our first service pack after two weeks. As to the second issue please remove temporary DataLoadMode="Asynchronous" if you are binding the grid to a service - this setting is not needed since the service binding itself is asynchronous. We have currently known issue with this mode (DataLoadMode="Asynchronous") and binding to WCF RIA services with auto-generated columns. 

All the best,
Vlad
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
Chris
Top achievements
Rank 1
answered on 08 Dec 2010, 01:03 PM
Hi Vlad,

The grids are not bound to RIA services, but numerous object based collections, but switching off asynchronous mode has resolved the problem.

Thanx,
Chris
0
Rupendra
Top achievements
Rank 1
answered on 05 May 2011, 10:26 PM
We have a grid which is loading columns programatically and each of the cell contains a child user control which adds either a label or a link or multiple links to the cell. The grid is using virtualization and contains couple of hundered records however there are two problems as far as the performance is concerned.

1. The memory footprint goes in increasing even by scrolling the grid up and down. We have seen it going from 6 MB to 150+ MB in a matter of minutes of scrolling.
2. The grid becomes extremly slow when styles are applied to it.

Turning Virtualization off fixes the ever increasing memory footprint.


Sidenote: We have also started getting a lot of errors descibed on this thread (http://www.telerik.com/community/forums/silverlight/gridview/system-nullreferenceexception-at-at-telerik-windows-controls-gridview-selectivescrollinggrid-layoutawarebindinghelperproxy.aspx). Can by chance that be a reason why the performance issues are also showing up ? This thread says that it has been fixed in the internal build. When do you plan to release that ?
0
Vlad
Telerik team
answered on 11 May 2011, 06:48 AM
Hi,

 I've replied to your other thread

Regards,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Chris
Top achievements
Rank 1
Rupendra
Top achievements
Rank 1
Share this question
or