This question is locked. New answers and comments are not allowed.
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:
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
>