Feature Request: API to free memory after processing

We have noticed that quite often, after processing a document, Aspose libraries retain some static information about that document that can consume quite a lot of memory.

While we know that you don’t consider this as a memory leak, we would like a way to ask Aspose to free that memory after it finished processing a document. Currently the best way we have to free that memory is to kill the process. We are looking for better ways to free that memory (e.g. a static function we can invoke)

Looking at other threads, I saw that you are aware of this behavior by Aspose. Let me know if you would like an example nevertheless

@User6572,
Could you please share which of the products are you using from Aspose.Total? Also if possible share some sample code (along with the template files if any) that can be used to reproduce the issue here. We will observe the scenario here with the target product and share our feedback accordingly.

1 Like

Thank you for the response!

I noted the behavior in Aspose.Cells and in Aspose.Words, though I believe it might happen in other products as well.

Attached is a simple Visual Studio project that loads two xlsx files and renders them using SheetRenders. We capture the memory footprint after processing the first document, and compare it to the footprint after processing the second file.

Despite not holding references to any resources, processing the second file causes an extra 60MB of memory to be used. I am looking for ways to release this memory, without killing the process (e.g. a new API call).

AsposeStaticMem.zip (14.9 KB)

@User6572,
We have observed this scenario for Aspose.Cells and logged it in our database for further investigation. We are analyzing the same for Aspose.Words and other products as well. You will be notified here once any update is ready for sharing.

This issue is logged for Aspose.Cells as given below:
CELLSNET-47901 - API required to free memory after processing

@User6572,

We have evaluated your issue regarding Aspose.Cells further.
We suggest you to kindly assign correct font for each characters in the file. For example, the font “Calibri” cannot support the character ✂️. We have to search a font which could display it in the default font directory, and we have to cache searched fonts data for performance. Now, please remove those cached data, see the following sample code:

using (var wb = new Workbook(path)) {

}  FontConfigs.SetFontFolder("", false);

Thank you! The call to SetFontFolder solves the issue in this case.

I ran into some documents the cached memory is not font related. I’ll open a new ticket once I run into such an example. As for using the correct font for each character - We are using Aspose to analyze customer content. Unfortunately, I don’t have control over the document’s content.

@User6572,

Good to know that it resolves your issue now.

Regarding other issues for Aspose APIs, please feel free to post (with all the details, samples and resource files) in relevant category on the forums. We will be happy to evaluate each issue and assist you accordingly.

1 Like