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); }
Could anyone will be in a possition to respond to this issues ? it is bit urgent ?
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.
http://community.infragistics.com/forums/p/40491/227135.aspx
Hope this helps.
May i know which version of infragitics you have used and i didnt get "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" and it is released most of the cases it is talked about non general scenarios.
I'm not sure how this memory allocation is released by repeating this steps
I do checked with microsoft, microsoft says it is Infragistics issue.
I am using the latest internal source which is essentially analogous to the latest hotfix for 9.1. Which part of that quote you listed would you like me to clarify? If it's about the object created then from what I recall, the only infragistics objects that were created were a couple of helper classes that are used for watching focus. When I say that this is just a baseline I mean that if I re-execute those steps any number of times (i.e. creating tabs and remove them using those steps) additional objects are not being created with each repeat of the steps - i.e. objects are not getting created and not being released.
What are the exact steps you are performing? What specifically is the memory leak (i.e. what objects are you seeing getting allocated which are not getting released when the panes are closed)? How are you testing for a memory leaks (note you cannot rely on the size of the working set)? What information did MS provide about what is leaking?
Hi Andrew,
I am Also finding the same memory leakage problem I am using xamdocmanager with documentcontenthost and and grouptab to host my contents initially. And when I doc my items from xamdocmanager its getting made and memory increasing up to 1.3GB aproximately and after that it terminated with out of memory exception ...
Can you please suggest someting about the issue.
Thanks.
Do you have a sample (and steps when running the sample) so I can look and see what memory is getting allocated and not released?
Well I dont have a sample application for that, But I can tell you in what steps I am getting this problem. Bellow is my code in xaml:
<
="1">
>
}" />
="MainDockContentHost">
="MainDocMgrSplitPanDocs" >
="Transparent">
I am adding my controls in MainDocMgrDocContentHost (TabGroup Item) on runtime like its working as my MDI parent Container. and to load components I am using follwing code:
ContentPane
content = new ContentPane();
content.Header =
"XYZ";
content.Content = MyUserControls;
content.CloseAction =
PaneCloseAction.RemovePane;
content.BorderThickness =
new Thickness(0);
MainDocMgrDocContentHost.Items.Add(content);
MainDocMgrDocContentHost.SelectedItem = content;
content.Name =
"ABC";
And MyUserControl is containing xamChart which is updating in VM by wcf call backs. Its working fine if i dont dock the Item. But as I Dock my Item memory start increasing till application crash. I have found another thing if I undock my Item to tabgroupcontrol its increase in size remains there but not as much fast as in Docked mode.