We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Open Workbook memory issues

Hi there,

I think there’s a issue regarding the memory release when opening a WorkBook in aspose.cells. The memory is never release (at least until other call is made to the service).

In the project that I’m involved we manage several huge Excel files with aspose, and the memory in server is really a critical point.

I already look in this foruns (google it as well) and I didn’t find any solution.

So, how can I close (dispose) the object Workbook after use?

In attach you can find a sample (web) to demonstrate what I’m saying.

1) Open the solution and run
2) Click “Button” (you will see the memory pointing to +/- 300MB…)
3) When the loading stops the memory will remaing in +/- 300MB (shouldn’t)
4) Open several windows in browser, and, in all of them, call the function (in my office sample i opened 3 and the memory went to 1GB (no release)…

It’s true that if I call the same pages again (in the opened windows) the memory will remain the same but what we really want is to clear the object from RAM memory.

Thanks in advance,


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.


Actually the problem is nothing to do with Web Projects, despite what we need is that.

In attach you will find a Windows Form Project which happens exactly the same thing.

Try this:
1) Run the project
2) Hit the button "call aspose"
3) hit the button 5 times in total (equal to my previous sample)

You will see that memory will stay at 1GB, exactly the same problem as the previous web project.

If you hit just one time the memory will be (and stay) at 300mb…

So, I still think that it should have a Dispose, or Close, method on WorkBook Class (to close all open streams, or/and other variables that should be closed).

Thanks in advance


Is there any news about this issue?

As I told before, this is nothing to do with web projects, and critical issue for our company.

We bought Aspose 1 month ago, but regarding this issue, we are tied up.

Thanks once again,


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.

Thank you.

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.

Best regards,


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.


I think that, in the Workbook, Aspose is not cleaning the open stream after use… I think the Dispose() / Close() method shall close any streams which is currently open.

I have some questions:
1. All objects which Aspose open are .net managed?

2. If not, you guarantee that all not .net managed objects are realeased?

The use of GB.Collect shall not be used (only in unique situation or test… - don’t think that is the case).

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.

Reference: http://msdn.microsoft.com/en-us/library/ee787088.aspx


Yes, all objects of Aspose.Cells are .NET managed object.

We do not use any unmanaged code.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan


Please dispose the workbook after processing:

    workbook = null;