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

System.OutOfMemoryException problem

Hello,
I have a question about an exception "Out of memory" for the following example:
-----------
DataTable table = .... //DataTable (34 Columns, 122 229 Rows)
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2010;

IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
IRanges bodyRange = worksheet.CreateRangesCollection();

bodyRange.Add(worksheet.Range[2, 1, table.Rows.Count + 1, table.Columns.Count]);
bodyRange.CellStyle.Color = Color.FromArgb(255, 255, 204);
bodyRange.CellStyle.Font.Size = 10;
bodyRange.CellStyle.Font.Color = ExcelKnownColors.Black;
bodyRange.CellStyle.Font.FontName = "Arial";
bodyRange.CellStyle.Font.Bold = false;
bodyRange.CellStyle.Borders.LineStyle = ExcelLineStyle.Thin;
bodyRange.CellStyle.Borders[ExcelBordersIndex.DiagonalDown].ShowDiagonalLine = false;
bodyRange.CellStyle.Borders[ExcelBordersIndex.DiagonalUp].ShowDiagonalLine = false;
bodyRange.RowHeight = 31.50;
----------
Exception message:
System.OutOfMemoryException: .... 'System.OutOfMemoryException'.
   w Syncfusion.XlsIO.Implementation.FontWrapper..ctor()
   w Syncfusion.XlsIO.Implementation.ExtendedFormatWrapper.SetFormatIndex(Int32 index)
   w Syncfusion.XlsIO.Implementation.RangeImpl.CreateStyleWrapper(Int32 value)
   w Syncfusion.XlsIO.Implementation.RangeImpl.CreateStyle()
   w Syncfusion.XlsIO.Implementation.RangeImpl.get_CellStyle()
   w Syncfusion.XlsIO.Implementation.StyleArrayWrapper.set_Color(Color value)
   
   
Dll uses Syncfusion.XlsIO.Web version 9.403.0.62
Windows XP, 2GB RAM, also tested with 4GB RAM
  
  

For Windows console application file generation successfully (output file size ~ 18,2MB)
------------
DataTable table = .... //DataTable (34 Columns, 122 229 Rows)
DateTime importDataTableTime = DateTime.Now;
worksheet.ImportDataTable(table, true, 1, 1, -1, -1, true);
-------------
For Web application (IIS) ImportDataTable throw "out of memory" exception.



Question: Is there any possibility to generate the excel file with the established styles, autoFilter for (datatable 34 columns, ~ 120000rows).
Some other way, workaround for 4 GB of RAM?


12 Replies

MM Manikandan M Syncfusion Team July 5, 2013 04:08 AM UTC

Hi Konrad

 

Thanks for using Syncfusion products.

We suspect that above reported issue occurs due to ‘memory leak issues’ in XlsIO. Memory leak issues have been handled efficiently and it is available in our latest volume 2 releases. So we highly recommend you to upgrade your product to newer version.

 

Download link for latest version:

http://www.syncfusion.com/downloads/latest-version

If still reproduce the issue, please revert back us with issue reproducing sample (or) datas which you import to workbook with sample scenario to reproduce the issue.

Please let us know if you need any clarifications.

Thanks,

Manikandan M.

 

 



KO Konrad July 9, 2013 09:19 AM UTC

Hi
Thanks for reply.
I downloaded the latest version of dll Syncfusion.XlsIO.Web [11.2035.0.25].
And after running the code
-------------
   DataTable table = .... //DataTable (34 Columns, 122 229 Rows)
            ExcelEngine excelEngine = new ExcelEngine();
            IApplication application = excelEngine.Excel;

            application.DefaultVersion = ExcelVersion.Excel2010;

            IWorkbook workbook = application.Workbooks.Create(1);
            IWorksheet worksheet = workbook.Worksheets[0];

            IRanges headerRange = worksheet.CreateRangesCollection();            
            headerRange.Add(worksheet.Range[1, 1, 1, table.Columns.Count]);
            headerRange.CellStyle.Color = Color.FromArgb(192, 192, 192);
-------------
again received exception "OutOfMemory" : 
-------------
Message:Lsi.PlayPaq.LrsCommonBll.DataExportToXls(...)System.OutOfMemoryException: ... 'System.OutOfMemoryException'.
   w Syncfusion.XlsIO.Implementation.FontWrapper..ctor()
   w Syncfusion.XlsIO.Implementation.ExtendedFormatWrapper.SetFormatIndex(Int32 index)
   w Syncfusion.XlsIO.Implementation.RangeImpl.CreateStyleWrapper(Int32 value)
   w Syncfusion.XlsIO.Implementation.RangeImpl.CreateStyle()
   w Syncfusion.XlsIO.Implementation.RangeImpl.get_CellStyle()
   w Syncfusion.XlsIO.Implementation.StyleArrayWrapper.set_Color(Color value)
-------------

Question: Is there any possibility to generate the excel file with the established styles, autoFilter for (datatable 34 columns, ~ 120000rows).
Some other way, workaround for 4 GB of RAM?


MM Manikandan M Syncfusion Team July 11, 2013 06:28 AM UTC

 



KO Konrad July 11, 2013 07:20 AM UTC

any ideas?


MM Manikandan M Syncfusion Team July 11, 2013 07:28 AM UTC

Hi Konrad,

 

We are sorry for the inconvenience.

 

We are able to reproduce the issue “OOM Exception takes place for large data’s” from our side. On analysis, we found that issue occurs due to inline style setting for range collections. We recommend you to create the global style and set it for the entire range to get the better performance as well as memory consumption. We have created the simplified sample with your scenario, but with global style and have shared the same in the below link.

 

Sample link: OOMException_Solution.zip

 

For further reference on global style setting, please go through the below online help link.

http://help.syncfusion.com/ug/windows%20forms/xlsio/default.htm#!Documents/improvingperformance.htm

 

Please let us know if you need any clarifications.

 

Thanks,

Manikandan M.



KO Konrad July 12, 2013 10:33 AM UTC

Thank you for your help.
I have another question.

Example: 
worksheet.UsedRange.AutofitColumns ();

For version Syncfusion.XlsIO.Web [11.2035.0.25]- not working
For version Syncfusion.XlsIO.Web [ 9.403.0.62] - working
Why?


KO Konrad July 16, 2013 08:38 AM UTC

Any ideas?
For the new version dll is a different solution AutoFit?


MM Manikandan M Syncfusion Team July 18, 2013 03:54 AM UTC

Hi Konrad,

 

We are sorry for the inconvenience.

 

We are not able to reproduce the issue “Autofit column not works in XlsIO”. We highly request you to update the issue reproducing scenario or sample. so that we can reproduce the issue and update you the solution ASAP.

 

Please let us know if you need any clarifications.

 

Thanks,

Manikandan M.

 



KO Konrad July 19, 2013 01:52 PM UTC

Hello
In attachment class and two output files generated
For version Syncfusion.XlsIO.Web [11.2035.0.25] => SampleOne11.2.xlsx
For version Syncfusion.XlsIO.Web [ 9.403.0.62] => SampleOne9.4.xlsx

Column "Q4" not autofit for version 11.2035.0.25




Sample_cb0befd1.zip


MM Manikandan M Syncfusion Team July 24, 2013 05:10 AM UTC

Hi Konrad,

 

Thanks for detailed update.

 

We are able to reproduce the issue “Autofit column does not work properly in XlsIO”. We suspect that this could be a defect and send to the development team for further analysis. Also we request you to create new incident to further follow up on this using below direct trac login.

 

Direct-Trac Link: Login

 

Please let us know if you need any clarifications.

 

Thanks,

Manikandan M.

 



KO Konrad July 24, 2013 07:41 AM UTC

Hello, I have last question:)

July 5, 2013 12:08 AM,  You response me : "We suspect That Occurs above reported issue due to 'memory leak issues' in XlsIO. Memory leak issues have been handled efficiently and it is available in our latest volume 2 releases."

Is the memory leak issues have been handled in version 10.4.0.71?
Konrad


MM Manikandan M Syncfusion Team July 24, 2013 08:43 AM UTC

Hi Konrad,

 

Thanks for your update.

 

The enhanced memory leak issue and performance issues are available in our latest version of Essential studio only.

 

Please let us know if you need any clarifications.

 

Thanks,

Manikandan M.

 


Loader.
Up arrow icon