Free Support Forum -

Questions on Memory Usage and File Size

I have the following questions regarding things I've seen with Apose.Cells:

1) I'm saving a file with 65000 Rows by ~49 columns. The resulting file size is about 41,944KB which isn't too bad. However, I opened the file in Excel and performed a save as and noticed that the file size dropped to 26,754KB. Is this because I have a large number of blank cells in the spreadsheet? I have a sample file that I can send with some scrubbed data, but prefer to post that privately.

2) Regarding memory usage. While producing the file mentioned in item 1, I noticed that the memory usage displayed in the task manager shoots up roughly 200 to 300 MB and doesn't release even after I set my excel object and sheets object to nothing. In fact, the only time it seems to release is when I call the .ImportFromDataReader the next time through the process. Is this normal? or is this a .net garbage collector problem?

Thank you for your assistance,


Hi Chris,

1) I think this file size issue is caused a large number of numeric cells instead of blank cells. I will optimize my code to make it better.

2) I think it's .Net GC's problem.

Please try this attached fix to see if the file size is smaller and speed is faster.

Thanks for the update. I'm not certain whether or not it impacted performance, but it did shrink the file size significantly. It appears that there may still be some extra meta data in the file that Excel throws out. I took a file that Aspose.Cells produced which was 28482 KB and using excel reduced it to 20637KB. I'm on vacation for the next week, so a colleague of mine may be checking my posts.
Another performance question, I noticed that during the save to a file operation the cpu usage shoots to 100% on my 65k rows by 50 columns. Do you have any thoughts on what might cause this? I've attached a screenshot of my Task Manager.

Finally, could you double check to see if the components are properly releasing memory after the sheet and excel objects are set to nothing? I could be wrong, but it appears that not all of the memory is being released.

Thanks again for your help,


1. About the file size issue: could you post your sample code here? I will check what makes this difference.

2. About CPU usage: creating such a large file is a heavy job so I think it's normal to take 100% CPU in a short time.

3. About memory issue: Aspose.Cells is a pure .Net component and we totally depend on .NET Garbage Collector(GC) to release memory. GC won't release memory when you set the objects to nothing. It only releases memory when it thinks it's appropriate.

Just wanted to clarify what you mean by sample code so that I post the correct information. Do you want the xls file that I'm using aspose to create + the version that I use MS Excel to save?


Hi Chris,

All these information are helpful.

I'm having difficulty attaching the file and will try tomorrow.

Here is the information for the file size differences:
1) Source Code:
Me.cmdORAOleDBCommand.CommandText = getSqlString()
oraDataReader = Me.cmdORAOleDBCommand.ExecuteReader()
lRowCount = sheet.Cells.ImportFromDataReader(oraDataReader, True, 0, 0, False)

2) I've attached a zip file with two files. The larger file was created with the aspose component using the code listed above. The smaller file was created by opening the aspose file in excel and using excel's save as.



Hi Chris,

I think that the size of your files may be too large to post them here. Please send them to Which version of Aspose.Cells are you using?