Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Sat Nov 18, 2023 4:08 pm

Hi,
I am trying your freeSpire.XLS to convert excel chart to image .

The code I am using is this :

Code: Select all
                                     Spire.Xls.Workbook workbook_spire = new();
                               
                                    //Loading Excel file
                                    workbook_spire.LoadFromFile(Path.Combine(mypath, "Out" + index + "_" + fileName));
                                    workbook_spire.Charts[0].SaveToImage(myOutfilePath);
                                    workbook_spire.Charts[0].Dispose();
                                    workbook_spire.Dispose();
                                    workbook_spire = null;




I assumed after disposing, my memory will be released. But it doesn't. I have used diagnostic tool in Visual Studio and it shows huge list of string and dictionary elements generated exactly after I call Spire.XLS and those are not released even after Dispose.

Memory consumption is as follows:
1. Heap size before calling spire --> arnd 10-12 MB
2. After spire --> arnd 95-100 MB
and this doesn't change after dispose (or very minor change)

Am I missing something?

somnathM
 
Posts: 1
Joined: Sat Nov 18, 2023 3:56 pm

Mon Nov 20, 2023 5:39 am

Hello,

Thank you for your inquiry.
About the Dispose() method in Spire.Xls, it is used to release objects and free up memory. However, the actual memory cleanup is managed by the system's garbage collection mechanism, which is not controlled by our product. Typically, the system will clean up the released heap memory after the process ends.
Additionally, you can also invoke the system's garbage collection method to forcibly reclaim the Workbook object.
Thank you for your understanding.

Sincerely,
Annika
E-iceblue support team
User avatar

Annika.Zhou
 
Posts: 1657
Joined: Wed Apr 07, 2021 2:50 am

Return to Spire.XLS