Heavy memory leak on .pdf creation.

I have a project which consists of Blazor Wasm (.NET 5.0) front-end and Asp.NET Core back-end API (.NET 5.0) to serve the front. I'm making POST call from front-end to API to export single or multiple .xlsx files to single .pdf document and then send the .pdf file back to front-end as byte array (byte[]) with some other information. The .xlsx files are located in wwwroot folder of the API.
Pdf creation works as it should and i'm able to get the file downloaded to the browser just fine. The problem is that during .pdf creation resources get stuck in the memory. I have attached a demo of this behavior. The size of the .xlsx file that gets opened in demo is roughly 149kb and the resulting .pdf file 77 kb. The actual method i'm using in my app is more complicated but this demo is enough to demonstrate the described behavior.

Here is the controller and that POST endpoint that gets called. IFormService contains the actual logic for creating .pdf file. Memory snapshot #1 is taken before
"CreateExampleFile" -method call and #2 just before exiting endpoint method (indicated by breakpoints in screenshot)


Here is the actual logic where .pdf file gets generated. Mapper is instance of AutoMapper.


Memory snapshot #2 compared to snapshot #1 shows 6,7 Mb of memory leak that mostly consists of memory streams created by syncfusion library.


What have i tried?
- opening .xlsx file to memory stream
- different styles of using encapsulations around MemoryStream/FileStream
- letting using block alone dispose PdfDocument
- manually calling PdfDocument.Close() with true and false parameters with and without using blocks
- many others

None of these have worked. The memory leak is also accumulating (every time that endpoint gets called, more resources get stuck in it).

Please help.

br. Ville

5 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 30, 2020 12:32 PM UTC

Hi Ville, 

Greetings from Syncfusion. 

We request you to share the Excel document you are using at your end and confirm us the Syncfusion XlsIO version your are using, which will be helpful for us in investigating the query and provide prompt solution at the earliest. 

Regards, 
Keerthi. 



VI Ville December 30, 2020 02:09 PM UTC

Hi,

Thanks for your reply.

Here are all the syncfusion package references used in my API project.

 <PackageReference Include="Syncfusion.Pdf.Net.Core" Version="18.4.0.31" />
 <PackageReference Include="Syncfusion.XlsIO.Net.Core" Version="18.4.0.31" />
  <PackageReference Include="Syncfusion.XlsIORenderer.Net.Core" Version="18.4.0.31" />

Could you provide an email address or other way to for me to deliver that .xlsx file privately? The file contains some work that i'm not planning to make public.

br. Ville


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team December 31, 2020 03:13 PM UTC

Hi Ville, 

Thanks for sharing the version details. 

You can share the Excel file to [email protected] or else you can create a support incident and share your file there. We just use the Excel files shared by you for reproducing the issue and testing. We will delete them once the work is done. 

Regards, 
Keerthi. 



VI Ville replied to Konduru Keerthi Konduru Ravichandra Raju December 31, 2020 04:28 PM UTC

Hi Ville, 

Thanks for sharing the version details. 

You can share the Excel file to [email protected] or else you can create a support incident and share your file there. We just use the Excel files shared by you for reproducing the issue and testing. We will delete them once the work is done. 

Regards, 
Keerthi. 


Hi Keerthi,

I've just sent the file to the address you mentioned. Thread name and id is mentioned in the mail for making it easier to find.

br. Ville


KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team January 4, 2021 12:52 PM UTC

Hi Ville, 

We regret to let you know that we have not received the mail from you. We have found that you have also created a feedback for same query. We request you to attach the Excel file in that feedback or resend to through mail.  


Regards, 
Keerthi. 


Loader.
Up arrow icon