We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:





91197 Nov 9,2009 11:02 AM UTC Nov 18,2009 08:19 AM UTC ASP.NET Web Forms (Classic) 6
Tags: GridGroupingControl
Sateesh Jain
Asked On November 9, 2009 11:02 AM UTC

The following Exception is thrown when Setting Data Source Caching Mode to Viewstate.

[OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.]
System.IO.MemoryStream.set_Capacity(Int32 value) +63
System.IO.MemoryStream.EnsureCapacity(Int32 value) +55
System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count) +245
System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) +95
System.IO.StreamWriter.Write(String value) +109
System.Xml.XmlTextEncoder.Write(String text) +108
System.Xml.XmlTextWriter.WriteString(String text) +72
System.Data.DataTextWriter.WriteString(String text) +12
System.Data.XmlDataTreeWriter.XmlDataRowWriter(DataRow row, String encodedTableName) +2354
System.Data.XmlDataTreeWriter.Save(XmlWriter xw, Boolean writeSchema) +888
System.Data.DataSet.WriteXml(XmlWriter writer, XmlWriteMode mode) +140
System.Data.DataSet.WriteXml(Stream stream, XmlWriteMode mode) +63
Syncfusion.Web.UI.WebControls.Grid.Grouping.Common.Utils.ConvertDataSetToString(Object oDataSource, XmlWriteMode xwmMode) +116
Syncfusion.Web.UI.WebControls.Grid.Grouping.Common.DataSourceSerializer.Serialize(Object oDataSource, DataSourceType& dstType) +257
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.SaveDataSource() +144
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.SaveViewState() +143
System.Web.UI.Control.SaveViewStateRecursive() +187

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +71
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +350
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) +19
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.ViewStateToSave() +242
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.SaveViewStateInternal() +160
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.GetViewStateUpdatingScript() +102
Syncfusion.Web.UI.WebControls.CallbackControlEnabler.SaveViewState() +96
Syncfusion.Web.UI.WebControls.CallbackDataBoundControl.SaveViewState() +123
Syncfusion.Web.UI.WebControls.Grid.Grouping.GridGroupingControl.SaveViewState() +114
System.Web.UI.Control.SaveViewStateRecursive() +187
System.Web.UI.Control.SaveViewStateRecursive() +106
System.Web.UI.Control.SaveViewStateRecursive() +106
System.Web.UI.Page.SaveAllState() +168
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1099

Bharath M [Syncfusion]
Replied On November 11, 2009 03:45 PM UTC

Hi Sateesh,

I am afraid that I am unable to reproduce the reported issue. I have created a simple sample to test this issue and I am able to render the Grid without any out of memory exception and the sample is available from attachment.

Please have a look at the attached sample and if still the issue exists, could you please try reproducing it in the above sample and send us the modified sample so that we could sort out the cause of the issue and provide you a solution?

Thanks and Regards,
Bharath .M


Sateesh Jain
Replied On November 12, 2009 06:33 AM UTC

Hi Bharath,

Actually i am binding datatable to the grid which is having number of rows more than 100000 and columns above 40. When data caching mode set to none then grid displays all the records. When data caching mode set to viewstate then it gives the Exception "System.OutOfMemeory". Same datatable data is converted to the xml and bind to the grid in your sample. Below is the attached sample.I tried by increasing the RAM of the Machine also.




Sateesh Jain
Replied On November 17, 2009 04:45 AM UTC


Is there any progress in this issue. It's very Urgent.



Bharath M [Syncfusion]
Replied On November 17, 2009 12:11 PM UTC

Hi Sateesh,

Thank you for your interest in Syncfusion products.

We regret for inconvenience caused. We suggest you to set the DatasourceCachingMode property to none for larger data manipulation. Caching DataSource in viewState will create OutOfMemoryException for larger data due to limited resource.

Essential Grid now supports binding to LINQ through the PassThruGroupingDataSource. “PassThroughGrouping” helps to optimize the Grid performance. PassThrough grouping is a great way to take control of the data being retrieved from the datasource. You can use this technique for fast retrieval and rendering of larger data.

LINQ is a great way to retrieve data from your data source. LINQ lets you build intuitive query expressions in any language of your choice, with optional support for transforming, projecting and shaping data into different forms, before it is displayed in the UI.


Please find the sample for PassThruGrouping in following link:

Please refer the Online sample from the below link:

For more information please visit our online documentation in the following link:

Thanks and Regards,
Bharath .M

Sateesh Jain
Replied On November 18, 2009 08:08 AM UTC

Hi Bharath,

The Sample Link you have given is not opening, Please Check.



Bharath M [Syncfusion]
Replied On November 18, 2009 08:19 AM UTC

Hi Sateesh,

Sorry for inconvenience caused. Please find the correct link below:

Thanks and Regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon