I have checked your test project, the memory does go to 300 MB once the workbook is loaded.
I have forwarded your issue to development team so that they could give you advice how to tackle the memory issue.
Also, I have logged your issue in our database. Once, there is some update relating to it available, we will let you know asap.
This issue has been logged as CELLSNET-40631.
IIS only recycle resource when the memory exceeds limitation or time interval triggers
Maybe you have to call GC by yourself ,see the following code:
var directory = Server.MapPath("/Excel/validation.xlsm");
var workGroup = new Workbook(directory);
workGroup = null;
And we are working on reducing memory when loading file.
Is there any news about this issue?
As we mentioned in the above post that we are working on reducing memory when loading file.
It could take some time, I guess, it could take couple of weeks. Anyway, I have logged your comment in our database against the issue id: CELLSNET-40631
Once, we have some update, we will get back to you.
We are working on improving memory performance for reading template files with large dataset. However, it is a complicated task and we are afraid it cannot be completed soon. And we do not think your issue is related to reading one large template file. In fact your memory issue (according to your requirement about Dispose or Close method) should be caused by that one Workbook object has not been disposed when your program finished using it. As we have said, you should use code like:
workGroup = null;
to let .Net dispose the resources definitely. By our test with your given project, after adding this code the memory used by the program is always about 300M when press “call” many times.
Hi, Thanks for your reply!
We are already "disposing" the workbook using the "workGroup = null;", but no difference made, regarding memory.
The use of GC.Collect is not an option for us. There are some issues regarding the use of the method, and causes other further issues.
We will wait for your updates (dispose / close method for workbook), and when you have that we will change our code.
What do you think the Close()/Dispose() method can do in Workbook object? The memory is used by datamodel of the Workbook(just assume that you have created a byte array that uses 300M memory and want to dispose it). We do not think there is a better way to release the memory explicitly than using GC. Even if we provide such a method, we can do nothing in it than using GC to release the datamodel. How and when the resources will be released depends on .Net framework completely and may be different for different envoirnments. For this point we are afraid we can do nothing.
Garbage collection occurs when one of the following conditions is true:
The system has low physical memory.
The memory that is used by allocated objects on the managed heap surpasses an acceptable threshold. This means that a threshold of acceptable memory usage has been exceeded on the managed heap. This threshold is continuously adjusted as the process runs.
The GC.Collect method is called. In almost all cases, you do not have to call this method, because the garbage collector runs continuously. This method is primarily used for unique situations and testing.
Yes, all objects of Aspose.Cells are .NET managed object.
We do not use any unmanaged code.
Please dispose the workbook after processing:
workbook.Dispose(); workbook = null;