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); }
I ran the application under the scitech memory profiler. Here's what I see:
I run the project and take a snapshot. I click the Add Tab menu item and then the Remove Tab menu item and take a snapshot. There are some objects allocated and remain in memory - static members initialized, etc. but there are no content panes around. This is primarily to baseline the sample. Now I click the Add Tab menu item and click the Remove Tab menu item and take a snapshot. There are no additional Infragistics objects around (i.e. the delta for all the infragistics objects is 0 so nothing added or removed).
Next I click the Add Tab menu and this time I click the close button in the tab header area, there are a couple of Infragistics object allocated but again primarily static stuff that has not been hit before. I repeat this step (click Add Tab and click the tab header area close button and snapshot). The delta for the Infragistics object is 0 (i.e. nothing added or removed).
Next I click the Add Tab menu item and this time I click the close button in the tab item. The delta for Infragistics objects is 0 (i.e. nothing added or removed).
Next I click the Add Tab menu item and this time I right click on the tab and choose Close. The delta for Infragistics objects is 0 (i.e. nothing added or removed).
Next I click the Add Tab menu item and this time I click on a radio button within the content pane to put focus within it and press Ctrl-F4 to close the document. A couple of objects were created but again this was to baseline the results. I repeat these steps and take a snapshot and the delta is 0.
Next I click the Add Tab menu item and this time I click the middle mouse button on the tab item. Again the delta is 0.
I'm not sure what steps you are doing or what you think is the memory leak but I don't see any leak. Are there some different steps that would need to be performed?
Please find the attached file
Please provide a sample that demonstrates the problem and we can look into it.
It didnt solve the problem it still leaks memory
Hi Senthilrajan,
Please find below the link that will guide you to downloading the service release you need.
http://community.infragistics.com/forums/t/29398.aspx
Please let us know if the latest version has helped you.
Thanks.