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. Image for the cookie policy date
close icon

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


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




6 Replies

BM Bharath M Syncfusion Team 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



Sample_277ea5fb.zip


SJ Sateesh Jain 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.


Regards


sateesh.



GridSample_5e126aff.zip


SJ Sateesh Jain November 17, 2009 04:45 AM UTC

hello

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

Regards


Sateesh.


BM Bharath M Syncfusion Team 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.

Syntax:


Please find the sample for PassThruGrouping in following link:
http://help.syncfubhsion.com/support/GGC.Web/7.4.0.20/91197/sample.zip

Please refer the Online sample from the below link:
http://samples.syncfusion.com/ASPNET/7.4.0.20/web/Grid.Grouping.Web/samples/3.5/Product%20Showcase/Pass-ThroughGrouping/CS/essentialgridwithlinq.aspx?args=0

For more information please visit our online documentation in the following link:
http://help.syncfusion.com/ug_74/gridweb/PassThroughGrouping.html

Thanks and Regards,
Bharath .M


SJ Sateesh Jain November 18, 2009 08:08 AM UTC

Hi Bharath,

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


Regards


Sateesh.




BM Bharath M Syncfusion Team November 18, 2009 08:19 AM UTC

Hi Sateesh,

Sorry for inconvenience caused. Please find the correct link below:
http://help.syncfusion.com/support/GGC.Web/7.4.0.20/91197/sample.zip

Thanks and Regards,
Bharath

Loader.
Live Chat Icon For mobile
Up arrow icon