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

Memory leaks when using radTooltipservice in RadTreeView

1 Answer 87 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Shirly
Top achievements
Rank 2
Shirly asked on 21 Apr 2013, 09:05 AM

I have added RadTooltipService to radTreeView, and have notices that there are memory leaks. I've used JustTrace and JetBrains profiler tools.

follwong is the way i've used RadTooltipService:

1. radTreeRow header Item dataTemplate: InputFile

<DataTemplate x:Key="InputFileTooltipTemplate" >
       <Grid x:Name="FileInfo" Width="Auto" >
           <Grid.Resources>
               <utils:ActualSizePropertyProxy Element="{Binding ElementName=FileInfo1}" x:Name="ActualSizeProxy"/>
           </Grid.Resources>
           <Grid.RowDefinitions>
               <RowDefinition Height="Auto" />
               <RowDefinition Height="Auto" />
           </Grid.RowDefinitions>
             
           <Grid x:Name="FileInfo1" Grid.Row="0" >
               <Grid.ColumnDefinitions>
                   <ColumnDefinition Width="Auto"/>
                   <ColumnDefinition Width="20"/>
                   <ColumnDefinition Width="Auto"/>
               </Grid.ColumnDefinitions>
               <Rectangle x:Name="EmptyRectangle" Grid.Row="0" Grid.Column="0" Fill="{StaticResource ControlBackground_Disabled}" StrokeThickness="0" Visibility="{Binding Thumbnail, Converter={StaticResource IsNullToVisibilityConverter}, ConverterParameter=Negate}" Width="110"  Height="110"/>
               <Image  x:Name="imageFile"   Source="{Binding Thumbnail, Converter={StaticResource ImageConverter}}" MaxWidth="110"  MaxHeight="110"/>
               <TextBlock Grid.Column="2" Text="{Binding Name}"  Foreground="{StaticResource Selection1Brush}" Height="18"  HorizontalAlignment="Left" VerticalAlignment="Top" />
               <StackPanel Grid.Column="2" VerticalAlignment="Bottom" Orientation="Vertical">
                   <StackPanel Orientation="Horizontal" >
                       <TextBlock  Text="{Binding Kind}"  Height="18"  Foreground="{StaticResource DefaultTextLightBrush}" VerticalAlignment="Bottom" Margin="0,24,0,0"  />
                       <TextBlock  Text="{Binding SizeDisplayString}"  Height="18"  Foreground="{StaticResource DefaultTextLightBrush}" VerticalAlignment="Bottom"   />
                   </StackPanel>
                   <StackPanel  Orientation="Horizontal" >
                       <TextBlock  Text="{Binding UploadDateTime}"  Height="18"  Foreground="{StaticResource DefaultTextLightBrush}"  />
                       <TextBlock  Text="{Binding Strings.InputFile_Uploaded, Source={StaticResource PlannerResourceWrapper}}"  Height="18"  Foreground="{StaticResource Secondary1Brush}"  />
                   </StackPanel>
               </StackPanel>
           </Grid>
            </Grid>
   </DataTemplate>

2.  radTreeRow child Item dataTemplate: Page

<DataTemplate x:Key="PageTooltipTemplate">
        <Grid x:Name="PageInfo">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" MaxWidth="110"/>
                <ColumnDefinition Width="20"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" MaxHeight="110"/>
            </Grid.RowDefinitions>
  
            <Rectangle x:Name="EmptyRectangle" Grid.Row="0" Grid.Column="0" Fill="{StaticResource ControlBackground_Disabled}" StrokeThickness="0" Visibility="{Binding Thumbnail, Converter={StaticResource IsNullToVisibilityConverter}, ConverterParameter=Negate}" Width="110"  Height="110"/>
            <Image  x:Name="imagePage"  Source="{Binding Thumbnail, Converter={StaticResource ImageConverter}}" MaxWidth="110"  MaxHeight="110" />
              
            <TextBlock  Text="{Binding Name}"  Foreground="{StaticResource Selection1Brush}" Height="18" Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Top" />
  
            <StackPanel Grid.Column="2" HorizontalAlignment="Left" VerticalAlignment="Bottom" Orientation="Vertical" >
                <StackPanel Orientation="Horizontal" >
                    <TextBlock  Text="{Binding Colors}"  Height="18"  Foreground="{StaticResource DefaultTextLightBrush}"  />
                    <TextBlock  Text="{Binding Strings.Page_Actual, Source={StaticResource PlannerResourceWrapper}}"  Height="18"  Foreground="{StaticResource Secondary1Brush}"  />
                </StackPanel>
  
                <StackPanel Orientation="Horizontal" >
                    <TextBlock  Text="{Binding NumOfAassignments,Converter={StaticResource PageAssignmentNumToStringConverter}}"  Height="18"  Foreground="{StaticResource DefaultTextLightBrush}"  />
                </StackPanel>
  
               </StackPanel>
        </Grid>
    </DataTemplate>

3. RowItem Style for both items: inputfile and page

<Style x:Key="ListInputFileTreeViewItemStyle" TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource DefaultRadTreeViewItemStyle}">
      <Setter Property="utils:StyleBinder.Binding">
          <Setter.Value>
              <utils:StyleBinding Binding="{Binding UIState.IsExpanded, Mode=TwoWay}" Property="IsExpanded"/>
          </Setter.Value>
      </Setter>
      <Setter Property="telerik:RadToolTipService.ToolTipContentTemplate" Value="{StaticResource InputFileTooltipTemplate}" />
      <Setter Property="telerik:RadToolTipService.ToolTipContent" Value="{Binding}"/> 
</Style>
<Style x:Key="ListPageTreeViewItemStyle" TargetType="telerik:RadTreeViewItem" BasedOn="{StaticResource DefaultRadTreeViewItemStyle}">
      <Setter Property="telerik:RadToolTipService.ToolTipContentTemplate" Value="{StaticResource PageTooltipTemplate}"/>
      <Setter Property="telerik:RadToolTipService.ToolTipContent" Value="{Binding}"/>
</Style>

hierarchical dataTemplate:

<telerik:HierarchicalDataTemplate x:Key="ListInputFileTemplate"
                                    ItemsSource="{Binding DisplayPages}"
                                    ItemTemplate="{StaticResource ListPageTemplate}"
                                    ItemContainerStyle="{StaticResource ListPageTreeViewItemStyle}">
      <ContentControl Template="{StaticResource CommonInputFileHeaderTemplate}"/>
  </telerik:HierarchicalDataTemplate>

RadTreeView

<telerik:RadTreeView x:Name="ListTreeView"
            telerik:RadDragAndDropManager.AllowDrag="True"
            ScrollViewer.VerticalScrollBarVisibility="Visible"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"
            PreviewDragEnded="RadTreeView_PreviewDragEnded"
            DragEnded="RadTreeView_DragEnded"
            Style="{StaticResource CommonInputFilesTreeViewStyle}"
            ItemsSource="{Binding SortedInputFiles}" 
            ItemTemplate="{StaticResource ListInputFileTemplate}"
            ItemContainerStyle="{StaticResource ListInputFileTreeViewItemStyle}" >
            <telerik:RadContextMenu.ContextMenu>
                <telerik:RadContextMenu x:Name="InputFileContextMenu" EventName="MouseRightButtonUp"                
                                        Placement="MousePoint"
                                        ItemsSource="{Binding InputFileMenuCommands, Converter={StaticResource RadMenuItemsConverter}}"/>
            </telerik:RadContextMenu.ContextMenu>
              
               </telerik:RadTreeView>
It's seems that even though the DataModel, and View doeb't exist any more the tooltip is still keeing them in memory by reference.
I have tried to remove the use of radToolTipService and memory leaks where gone.
I'm using VS2010 silverlight, Telerik.Windows.Controls version is : 2012.3.1129.1050 runtime version is: v4.0.30319

Can you check why I'm having these memory leaks?

1 Answer, 1 is accepted

Sort by
0
Vladislav
Telerik team
answered on 23 Apr 2013, 08:17 AM
Hello Shirly,

Thank you for this report.
We managed to narrow a memory leak within the RadTreeView control, caused by the RadContextMenu.
It is logged here, where you can track its progress and vote for it.
We however wasn't able to reproduce a memory leak specific to RadToolTip control used in the RadTreeView.
Can you please review the attached project, where we located the memory leak and let us know if your scenario/project differs significantly from it. It will be best if you can send us a sample project demonstrating the memory leak with the RadToolTip control, in order to further investigate it at our side.

Your Telerik points are updated accordingly.

Greetings,
Vladislav
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
General Discussions
Asked by
Shirly
Top achievements
Rank 2
Answers by
Vladislav
Telerik team
Share this question
or