Hi,
We are using dockmanager and Group Pane inside that we have set of content panes. When we close the content pane it is not releasing memory. This issue i already raised in support request but the solution is not perfect it is leaking memory.
Please revert back, It is urgent
I'm unable to upload the file since forum site is having issues in file uploading
Code:
<igRibbon:XamRibbonWindow x:Class="XamTabControlTest.Window2" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:igDock="http://infragistics.com/DockManager" xmlns:igRibbon="http://infragistics.com/Ribbon" Title="Window2" Height="300" Width="300"> <igRibbon:XamRibbonWindow.Resources> <DataTemplate x:Key="tabItemHeaderWithClose"> <DockPanel x:Name="pnl"> <Button x:Name="closeBtn" DockPanel.Dock="Right" Visibility="Collapsed" Margin="3,3,0,3" VerticalAlignment="Center" Command="{x:Static igDock:ContentPaneCommands.Close}" CommandTarget="{Binding Path=Pane,RelativeSource={RelativeSource AncestorType={x:Type igDock:PaneTabItem}}}" Style="{DynamicResource {x:Static igDock:TabGroupPane.DocumentCloseButtonStyleKey}}" /> <TextBlock Text="{Binding}" /> </DockPanel> <DataTemplate.Triggers> <Trigger Property="igDock:XamDockManager.PaneLocation" Value="Document"> <Setter TargetName="closeBtn" Property="Visibility" Value="Visible" /> </Trigger> <DataTrigger Binding="{Binding Path=Role, RelativeSource={RelativeSource AncestorType={x:Type MenuItem}}}" Value="SubmenuItem"> <Setter TargetName="closeBtn" Property="Visibility" Value="Collapsed" /> </DataTrigger> </DataTemplate.Triggers> </DataTemplate> </igRibbon:XamRibbonWindow.Resources> <igRibbon:RibbonWindowContentHost > <Grid> <DockPanel LastChildFill="True" HorizontalAlignment="Stretch" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Stretch" DockPanel.Dock="Top" > <Menu Width="1024"> <MenuItem Name="mnuCheck" Header="Tab Menu" > <MenuItem Header="Add New Tab" Click="MenuItem_Click"/> <MenuItem Header="Remove Last" Click="MenuItem_Click_1"/> <MenuItem Header="GC" Click="MenuItem_Click_2"/> </MenuItem> </Menu> </StackPanel> <igDock:XamDockManager DockPanel.Dock="Bottom" xmlns:igDock="http://infragistics.com/DockManager" Background="Transparent" Margin="2,2,2,2"> <igDock:DocumentContentHost> <igDock:SplitPane> <igDock:TabGroupPane Name="cgGroupPane" Background="Transparent"> </igDock:TabGroupPane> </igDock:SplitPane> </igDock:DocumentContentHost> </igDock:XamDockManager> </DockPanel> </Grid> </igRibbon:RibbonWindowContentHost></igRibbon:XamRibbonWindow>
Code Behind:
public void AddContentPane(ContentPane objContentPane, string strContentHeader) { try {
objContentPane.Header = strContentHeader; objContentPane.AllowDocking = false; objContentPane.AllowDockingFloating = false; objContentPane.AllowDockingInTabGroup = false; objContentPane.AllowDockingInTabGroup = false; objContentPane.AllowDockingLeft = false; objContentPane.AllowDockingRight = false; objContentPane.AllowDockingTop = false; objContentPane.AllowPinning = false; objContentPane.AllowDockingBottom = false; objContentPane.IsPinned = false; objContentPane.AllowDrop = false; objContentPane.AllowFloatingOnly = false; objContentPane.AllowInDocumentHost = false; objContentPane.TabHeaderTemplate = (System.Windows.DataTemplate)this.FindResource("tabItemHeaderWithClose"); objContentPane.Closed +=new EventHandler<Infragistics.Windows.DockManager.Events.PaneClosedEventArgs>(objContentPane_Closed); cgGroupPane.Items.Add(objContentPane); objContentPane.Activate(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } int count = 0; Contents ct; private void MenuItem_Click(object sender, RoutedEventArgs e) { ct = new Contents(); count = count + 1; AddContentPane((ContentPane)ct, "New"); } private void objContentPane_Closed(object sender,Infragistics.Windows.DockManager.Events.PaneClosedEventArgs e) { ((ContentPane)sender).Closed -= new EventHandler<Infragistics.Windows.DockManager.Events.PaneClosedEventArgs>(objContentPane_Closed); cgGroupPane.Items.RemoveAt(count - 1); ct = null; count = count - 1; System.GC.Collect(0,GCCollectionMode.Forced); System.GC.Collect(1, GCCollectionMode.Forced); System.GC.Collect(System.GC.MaxGeneration, GCCollectionMode.Forced); }
private void showMessage() { MemoryStream ms = new MemoryStream(); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(ms, bf); MessageBox.Show(ms.Length.ToString()); ms.Close(); }
private void MenuItem_Click_1(object sender, RoutedEventArgs e) { try { //showMessage(); cgGroupPane.Items.RemoveAt(count - 1); ct = null; count = count - 1; //showMessage(); } catch (Exception ex) { } finally { //MessageBox.Show(GC.GetTotalMemory(false).ToString()); System.GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); //MessageBox.Show(GC.GetTotalMemory(false).ToString()); } }
private void MenuItem_Click_2(object sender, RoutedEventArgs e) {// System.Threading.Thread.Sleep(2000); System.GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced); }
Hi Galina Edinakova,
Thanks for your reponse, we do use grouppane.RemoveAt option when we closing the pane as shown in the example, but still it is leaking memrory. When we profile the application a week refernce has been made between a ribbon window and the content pane. which means a effectivevalueentry is made between these two and we are unable to break it.
We are using .NET advantage 2009.1, we have done all the testing so we are not in a possition to upgrade to latest version but could you please let me know where to download the hot fix which is mentioned in the siteand will it solve my issue
http://community.infragistics.com/forums/p/40491/227135.aspx
Thanks & Regards,
Senthilrajan
Hello,
I'm sorry if I'm suggesting something you already know, but I was wondering if you have tried to set the ContentPane's CloseAction property to "RemovePane". Otherwise, as stated in the post below, closing the pane would just set its visibility to Collapsed.
Hope this helps.
Could anyone will be in a possition to respond to this issues ? it is bit urgent ?