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

Free Support Forum - aspose.com

Release memory after loading huge excel file via Aspose.Cells in .NET

Hi team,

I am using Aspose.Cells to open a huge .xls file and see that memory is still so high although I called Workbook.Dispose. This is my steps to create sample huge .xls file:

My sample code i used to test:

        static void Load_XLS(string input)
                Aspose.Cells.LoadOptions opt = new Aspose.Cells.LoadOptions();
                //Set the memory preferences
                opt.MemorySetting = MemorySetting.MemoryPreference;
                Workbook workbook = new Workbook(input, opt);
                //Try to release resources by using Dispose
                Console.WriteLine("Xls file is loaded successfully");
            catch (Exception e)
                Console.WriteLine("Failed to load xls file. " + e.Message);

        static void Main(string[] args)
            Aspose.Cells.License asposelicense = new Aspose.Cells.License();


            System.Threading.Thread.Sleep(30000); // Sleep 30s to observe the memory

Run this code and observe the memory it uses, after message “Xls file is loaded successfully” is showed, the memory is still not released (more than 1,5GB).

Please help,


Thanks for the sample code and details.

Well, Aspose.Cells is written in managed code (.NET), so the process of releasing resources (memory) was mainly controlled by the language (.NET framework) itself. Since you are loading a workbook with huge size, so it will surely demand lots of memory and the process would take time. We recommend you to kindly try GC.Collect() method instead. Moreover, if memory was not released out of the scope, it might be due to the system’s GC does not work yet and the framework will determine when it starts to do the work.