How to make sure that the Workbook objects are Garbage Collected

Hi,


I am processing a List of WorkBooks in a loop.
I also will be creating temp Workbook for each workbook.
I see that the WorkBook, Cells, Worksheet objects doesn’t have dispose method.
Are these objects use purely .NET properties?
How do I make sure that these heavy objects are Garbage Collected once they go out of scope.
I am currently just resetting the object to null in the finally block, like:
Workbook workbook;
try {
workbook = new Workbook();
----
----
}
finally
{
workbook = null;
}

Please suggest if there is a better way to make sure I don’t ran out of memory while in the middle of processing the Workbooks.

Thanks
-Padma
Hi,

Well, the component (Aspose.Cells for .NET) does not necessarily require really to free up the resources for the processes as the component is already optimized to do so automatically. Aspose.Cells is created in managed C# and is a pure .NET component, we do not use un-managed code. When objects are no more useful in the processes, GC would collect and release the memory occupied by the objects. Being a pure .NET component, Aspose.Cells for .NET relies on .NET garbage collector (GC) to allocate and free the memory for the different processes, although you may try to also use GC.Collect() or set Workbook to null in some cases for your need. Moreover, if you are using Stream objects, you need to call Close() and Flush() methods to manually release the resources for the objects when they are not used.

Thank you.