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

GridView causing out of memory exception (Q4 2010)

9 Answers 466 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Marc
Top achievements
Rank 1
Marc asked on 07 Feb 2011, 05:49 PM


Any ideas on the following exception we are receiving in a grid with about 1000 rows of data.  I believe our specific version is 4_2010_2_1022.

System.OutOfMemoryException crossed a native/managed boundary

  Message=Exception of type 'System.OutOfMemoryException' was thrown.

  StackTrace:

       at MS.Internal.Error.GetXresultForUserException(Exception ex)

       at MS.Internal.FrameworkCallbacks.ManagedPeerTreeUpdate(IntPtr oldParentElement, IntPtr parentElement, IntPtr childElement, Byte bIsParentAlive, Byte bKeepReferenceToParent, Byte bCanCreateParent)

       at MS.Internal.XcpImports.MethodExNative(IntPtr context, IntPtr element, UInt32 cString, String name, UInt32 cParams, IntPtr pParams, CValue& outval, Int32& typeIndex)

       at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)

       at MS.Internal.XcpImports.MethodEx(DependencyObject obj, String name)

       at MS.Internal.XcpImports.FrameworkElement_ApplyTemplate(FrameworkElement frameworkElement)

       at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.GetElementRoot(Boolean templatesAreGenerated)

       at System.Windows.Controls.ItemContainerGenerator.LayoutStatesManager.Load()

       at System.Windows.Controls.ItemContainerGenerator.System.Windows.Controls.Primitives.IItemContainerGenerator.PrepareItemContainer(DependencyObject container)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertContainer(Int32 childIndex, UIElement container, Boolean isRecycled)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.InsertNewContainer(Int32 childIndex, UIElement container)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.AddContainerFromGenerator(Int32 childIndex, UIElement child, Boolean newlyRealized)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChild(IItemContainerGenerator generator, Size constraint, GridViewColumn column, Int32& childIndex, Size& childSize)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateChildren(IItemContainerGenerator generator, Int32 startIndex, Int32 endIndex, Size constraint)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.GenerateAndMeasureChildrenForRealizedColumns(Size constraint)

       at Telerik.Windows.Controls.GridView.GridViewCellsPanel.MeasureOverride(Size constraint)

       at System.Windows.FrameworkElement.MeasureOverride(IntPtr nativeTarget, Single inWidth, Single inHeight, Single& outWidth, Single& outHeight)



Edit:
It appears that as users make changes in the grid, internet explorer is gradually using more and more memory until it eventually crashes. We need to isolate this behavior. Please help.

This is happening on multiple systems with both XP and Windows 7, both 32 bit and 64 bit.

Xaml snippet below:

<UserControl x:Class="BATC.MPP.SilverlightInterface.Views.BillOfMaterialsView"
    mc:Ignorable="d"
    xmlns:vm="clr-namespace:BATC.MPP.SilverlightInterface.ViewModels"
    xmlns:em="clr-namespace:BATC.MPP.Services.Web;assembly=BATC.MPP.Services"
    xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
    xmlns:riaData="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
    xmlns:my="clr-namespace:BATC.MPP.Services.Web;assembly=BATC.MPP.Services"
    xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"
    xmlns:batc="clr-namespace:BATC.SilverlightSharedLibrary;assembly=BATC.SilverlightSharedLibrary"
    d:DesignHeight="600" d:DesignWidth="1200">
 
    <UserControl.Resources>
        <vm:BomViewModel x:Key="BomViewModel" />
        <batc:MinDateToEmptyStringConverter x:Key="MinDateToEmptyStringConverter" />
        <telerik:BooleanToVisibilityConverter x:Key="MyBooleanToVisibilityConverter" />
    </UserControl.Resources>
 
    <Grid Name="MainGrid"
        DataContext="{Binding Source={StaticResource BomViewModel}}">
 
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="90*" />
        </Grid.RowDefinitions>
 
        <telerik:RadContextMenu.ContextMenu>
            <telerik:RadContextMenu x:Name="BomContextMenu" Opened="BomContextMenu_Opened">
                <telerik:RadMenuItem Header="Add Part"
                    Command="{Binding AddPart}" />
                <telerik:RadMenuItem Header="Import Parts From File"
                    Command="{Binding FileUpload}" />
            </telerik:RadContextMenu>
        </telerik:RadContextMenu.ContextMenu>
 
        <StackPanel Orientation="Horizontal"
            Grid.Row="0">
            <telerik:RadButton Content="Add Part"
                Name="AddPartButton"
                Command="{Binding AddPart}"
                Visibility="{Binding IsActive, Converter={StaticResource MyBooleanToVisibilityConverter}}"
                Margin="4" />
            <telerik:RadButton Content="Delete Selected Parts"
                Name="DeletePartButton"
                Command="{Binding DeleteBomPart}"
                Visibility="{Binding IsActive, Converter={StaticResource MyBooleanToVisibilityConverter}}"
                Margin="4" />
            <telerik:RadButton Content="Import Parts From File"
                Name="ImportPartButton"
                Command="{Binding Path=FileUpload}"
                Visibility="{Binding IsActive, Converter={StaticResource MyBooleanToVisibilityConverter}}"
                Margin="4" />
            <telerik:RadButton Content="Export to Excel"
                Name="ExportButton"
                Click="ExportButtonClick"
                Margin="4" />
            <telerik:RadButton x:Name="FindButton"
                Content="Find"
                Click="FindButtonClick"
                Margin="4" />
            <telerik:RadButton x:Name="RefreshButton"
                Content="Refresh"
                Click="RefreshButtonClick"
                Margin="4" />
            <sdk:Label Margin="4"
                Content="Selected Proposal:" />
            <sdk:Label Height="22"
                Name="CurrentPropName"
                Width="410"
                Margin="4"
                Content="{Binding SelectedProposalPropAndVerName}"
                BorderThickness="0" />
            <sdk:Label Height="22"
                Name="LoadProgress"
                Width="263"
                Margin="4"
                Content="{Binding LoadProgress}"
                BorderThickness="0" />
        </StackPanel>
 
 
        <StackPanel Name="FindPanel"
            Orientation="Horizontal"
            Visibility="Collapsed"
            Grid.Row="1"
            Margin="4">
            <telerik:RadComboBox Name="SearchFieldComboBox" Margin="2" HorizontalAlignment="Center">
                <telerik:RadComboBoxItem Content="Part #" IsSelected="True" />
                <telerik:RadComboBoxItem Content="Description" />
                <telerik:RadComboBoxItem Content="Sequence" />
                <telerik:RadComboBoxItem Content="Comm Cd" />
                <telerik:RadComboBoxItem Content="Lifecycle" />
                <telerik:RadComboBoxItem Content="Mfg PN" />
                <telerik:RadComboBoxItem Content="Category" />
                <telerik:RadComboBoxItem Content="Reference #" />
            </telerik:RadComboBox>
            <TextBox Name="SearchTextBox"
                Height="22"
                Width="120"
                Margin="2" GotFocus="DescTextBox_GotFocus" />
            <telerik:RadButton Name="FindButtonGo"
                Content="Find"
                Height="20"
                Click="FindButtonGoClick"
                Margin="2" />
            <telerik:RadButton Name="CloseFindPanelButton"
                Content="x"
                Height="20"
                Click="CloseFindPanelButtonClick"
                HorizontalAlignment="Right"
                Margin="2" />
            <TextBox Name="CountTextBox"
                Height="22"
                Width="220"
                Margin="18,2,2,2" BorderThickness="0" FontSize="9" />
 
        </StackPanel>
 
        <telerik:RadGridView x:Name="bomGridView"
            AutoGenerateColumns="False"
            Grid.Row="2"
            SelectionMode="Extended"
            SelectionUnit="FullRow"
            ItemsSource="{Binding Path=BomParts, Source={StaticResource BomViewModel}}"
            SelectionChanged="bomGridView_SelectionChanged"
            EnableColumnVirtualization="False" >
            <telerikNavigation:RadContextMenu.ContextMenu>
                <telerikNavigation:RadContextMenu Name="ContextMenu" Opened="ContextMenu_Opened">
                    <telerikNavigation:RadMenuItem Name="AddChildPartMenuItem"
                        Header="Add Child Part"
                        Command="{Binding AddPart}"
                        CommandTarget="{Binding ElementName=bomGridView, Path=SelectedItem.Children}"
                        CommandParameter="child" />
                    <telerikNavigation:RadMenuItem Name="EditBomPartMenuItem"
                        Header="Edit Part"
                        Click="EditBomPartMenuItemOpen" />
                    <telerikNavigation:RadMenuItem Header="Delete"
                        Name="DeleteMenuItem"
                        Command="{Binding DeleteBomPart}" />
                    <telerikNavigation:RadMenuItem Header="Copy Assy"
                        Name="CopyMenuItem" Click="CopyMenuItem_Click" />
                </telerikNavigation:RadContextMenu>
            </telerikNavigation:RadContextMenu.ContextMenu>
 
            <telerik:RadGridView.Columns>
                <telerik:GridViewDataColumn Header="Part #"
                    DataMemberBinding="{Binding Part.PartNumber}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Description"
                    DataMemberBinding="{Binding Part.Description}"
                    Width="150"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Indenture"
                    DataMemberBinding="{Binding IndentureLevel}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Graphic Level" IsReadOnly="True" >
                    <telerik:GridViewDataColumn.CellTemplate>
                        <DataTemplate>
                            <sdk:Label FontFamily="Courier New" FontSize="13" Content="{Binding GraphicLevel}" />
                        </DataTemplate>
                    </telerik:GridViewDataColumn.CellTemplate>
                </telerik:GridViewDataColumn>
                <telerik:GridViewDataColumn Header="Sequence Number" IsReadOnly="True"
                    DataMemberBinding="{Binding SequenceNumber, Mode=TwoWay}" />
                <telerik:GridViewDataColumn Header="WBS"
                    DataMemberBinding="{Binding WorkBreakdown.WorkBreakdownNumber}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Phase"
                    DataMemberBinding="{Binding PurchasePhase.PurchasePhaseName}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Qty"
                    DataMemberBinding="{Binding Qty}"
                    DataFormatString="{}{0:##.#############}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Total Qty"
                    DataMemberBinding="{Binding TotalQty, Mode=TwoWay}"
                    DataFormatString="{}{0:##.###############}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="M/B"
                    DataMemberBinding="{Binding MakeBuyCd, Mode=TwoWay}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Adj MB"
                    DataMemberBinding="{Binding MakeBuyCdOverrideValue, Mode=TwoWay}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="PDM Part"
                    DataMemberBinding="{Binding Part.AgilePartFl}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="As Req"
                    DataMemberBinding="{Binding AsRequiredFl}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Comm Cd"
                    DataMemberBinding="{Binding Part.CommodityCode}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Lead Time"
                    DataMemberBinding="{Binding Part.LeadTime}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Lifecycle"
                    DataMemberBinding="{Binding Part.Lifecycle}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="L/L"
                    DataMemberBinding="{Binding Part.LimitedLifeFl}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Mfg PN"
                    DataMemberBinding="{Binding Part.ManufacturePartNumber}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Category"
                    DataMemberBinding="{Binding Part.PartCategory}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="Ref Num"
                    DataMemberBinding="{Binding Part.ReferenceNumber}"
                    IsReadOnly="True" />
                <telerik:GridViewDataColumn Header="U/M"
                    DataMemberBinding="{Binding Part.UM}"
                    IsReadOnly="True" />
            </telerik:RadGridView.Columns>
        </telerik:RadGridView>
    </Grid>
</UserControl>






9 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 08 Feb 2011, 08:22 AM
Hello,

 Most probably you have Q2 2010 - we do not have Q4 release from more than 3 years. Can you try our latest official version - Q3 2010 SP1? Can you verify if the grid is not measured with infinity? The easiest way to check this is to look at the vertical RadGridView scrollbar - if present everything should be fine. 

Kind regards,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Marc
Top achievements
Rank 1
answered on 08 Feb 2011, 04:52 PM
We are running 4_2010_2_1022. Please clarify if this is the latest available to us.

Also, it looks like some memory is being release if I comment out the column with the DataTemplate. Is there some known memory issues using the datatemplate?
0
Hristo
Telerik team
answered on 08 Feb 2011, 05:20 PM
Hello Marc,

You are running a latest internal build for our Q2 official release. The current official release is Q3 2010 and the latest LIB version is 2010_3_1407. You can download the Trial dlls from this link. If you need the Dev dlls you need to download our latest official release and then you'll see them here.

Regards,
Hristo
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Marc
Top achievements
Rank 1
answered on 08 Feb 2011, 08:02 PM
Even with the new binaries, I am seeing memory leaks directly related to the Telerik controls. As I switch the controls out for standard silverlight controls the memory leaks start to go away.
0
Vlad
Telerik team
answered on 09 Feb 2011, 08:30 AM
Hi,

 Can you send us an example project where this can be reproduced? 

Kind regards,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
PRAMOD
Top achievements
Rank 1
answered on 09 Feb 2011, 02:27 PM
sir,
I am using RadGridView for binding Employee data,for 2000 employee record it is working fine but application crashes for nearly 6000 records.
please tell me what is the problem and what is solution for it.
0
Vlad
Telerik team
answered on 09 Feb 2011, 02:34 PM
Hi,

 Most probably your grid is measured with infinity height. You can check this article for more info. 

All the best,
Vlad
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Roshan
Top achievements
Rank 1
answered on 09 Nov 2018, 12:42 AM

Hi,

 We are using version 9.2.15.930 and are seeing an out of memory issue when trying to copy data (10k) from a grid or trying to preview as pdf. Could you please let us know if later versions handle large data without memory exceptions or is there a work around which we can use in the version we have?

 

0
Stefan
Telerik team
answered on 13 Nov 2018, 02:25 PM
Hi Roshan,

Can you please confirm that you are using the UI for Silverlight, as the posted assemblies version is from the Reporting suite? If this is so, can you please confirm the UI for Silverlight version that you are using?

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
GridView
Asked by
Marc
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Marc
Top achievements
Rank 1
Hristo
Telerik team
PRAMOD
Top achievements
Rank 1
Roshan
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or