AD
Administrator
Syncfusion Team
June 20, 2005 11:37 AM UTC
WHY NO ONE ANSWERS MY QUESTION ?
>Each time i run this code, the memory grows and is NEVER reclaimed:
>Any idea ? Is ther a memory leak on ExcelRW ?
>
>ExcelEngine excelEngine = new ExcelEngine();
>IApplication application = excelEngine.Excel;
>IWorkbook myWorkBook = excelEngine.Excel.Workbooks.Add();
>IWorksheet sheet = myWorkBook.Worksheets[0];
>
>
> for (int i = 0;i<=grid.RowCount;i++)
> {
>
> sheet.Range[i+1,1].RowHeight = (grid.RowHeights[i]/1.33);
>
> for(int j=0; j<=grid.ColCount;j++)
> {
> if(grid[i,j].HasBaseStyle)
> {
> sheet.Range[i+1,j+1].CellStyleName = grid[i,j].BaseStyle.ToString();
> }
>
> sheet.Range[1,j+1].ColumnWidth = (grid.ColWidths[j]/7.43);
> sheet.Range[i+1,j+1].Value2 =grid[i,j].Text ;
> }
> }
AD
Administrator
Syncfusion Team
July 21, 2005 04:11 PM UTC
I think the problem is that you need to invoke Close on the workbook (of course, ideally in a finnaly block). My tests have shown the same issue, until I added a call to Close on the worksheet. It''s not at all clear to me why Syncfusion did not implement Dispose on the Worbook.
Mind you that my tests have shown that the solution above (i.e. call Close when done with the workbook) only solves the issue when you are not creating new worksheets. Any new worksheets added to the workbook will cause the memory to grow and will not be reclaimed, even after you call Close on the workbook.
AD
Administrator
Syncfusion Team
July 21, 2005 07:00 PM UTC
Hi,
Currently we are investigating into these Memory usage issues and will have a resolution soon. Please bear with use till then.
Thanks,
Stephen.
>I think the problem is that you need to invoke Close on the workbook (of course, ideally in a finnaly block). My tests have shown the same issue, until I added a call to Close on the worksheet. It''s not at all clear to me why Syncfusion did not implement Dispose on the Worbook.
>Mind you that my tests have shown that the solution above (i.e. call Close when done with the workbook) only solves the issue when you are not creating new worksheets. Any new worksheets added to the workbook will cause the memory to grow and will not be reclaimed, even after you call Close on the workbook.
AD
Administrator
Syncfusion Team
May 9, 2008 11:06 AM UTC
From windbg:
0x0ce87f60 96,697 7,735,760 Syncfusion.ExcelRW.Implementation.RangeImpl
0x10166894 182,075 11,169,900 Syncfusion.Styles.StyleInfoObjectStore/ObjectEntry[]
0x79ba2f5c 619,566 14,869,584 System.Collections.ArrayList
0x0ce8e7bc 576,561 16,143,708 Syncfusion.ExcelRW.Implementation.ValueChangedEventHandler
0x0ce947ac 1,017,475 16,279,600 Syncfusion.ExcelRW.Implementation.ExtendedFormatImplWrapper
0x10166220 1,045,570 18,572,668 System.Collections.Specialized.BitVector32[]
0x0ce9a1ac 460,392 25,781,952 Syncfusion.ExcelRW.Implementation.StyleImpl
0x0ce84ff4 460,392 29,465,088 Syncfusion.ExcelRW.Implementation.Collections.BordersCollection
0x00e62970 50,235 32,226,792 System.Collections.Hashtable/bucket[]
0x0ce93d5c 920,791 36,831,640 Syncfusion.ExcelRW.Implementation.ExtendedFormatImpl
0x0014e410 911 40,079,868 Free
0x0ce95294 1,580,750 44,261,000 Syncfusion.ExcelRW.Implementation.FontImplWrapper
0x00e6209c 748,363 62,477,424 System.Object[]
0x1c8b6a94 920,792 62,613,856 Syncfusion.ExcelRW.Parser.Biff_Records.ExtendedFormatRecord
0x0ce94dac 1,473,521 64,834,924 Syncfusion.ExcelRW.Implementation.FontImpl
0x79b946b0 1,634,332 77,836,800 System.String
0x1c8b7b64 1,473,522 82,517,232 Syncfusion.ExcelRW.Parser.Biff_Records.FontRecord
0x0ce8fce0 2,762,352 88,395,264 Syncfusion.ExcelRW.Implementation.BorderImpl