Memory Leak in PDF Conversion

Hi Team,


Looks like Aspose is not releasing(disposing) the Memory used. I’m trying to convert an HTML file into PDF and while converting I’m seeing that the Memory raised from 5MB to 150MB-160MB. This is one Big Issue which is affecting the consumption of Memory with our Application.

This is like a straight forward Issue that the Memory is not being DISPOSED!!!

I’m attaching the file which I tried to convert and the Code file.



Please look into this ASAP, since we’re in Production Environemnt and We are having a Site OEM license with our organization Factset Research Systems.

Thanks,
Shanthi

Hi Shanthi,


Thanks for your inquiry. I am afraid I am unable to notice the reported issue. I have tested the scenario and noticed that memory raises to 150+ MB during processing and then disposed properly. Please note Aspose.Pdf processes the files in memory instead disk, so memory consumption depends upon the file size and contents. However if there is some difference in your query and my understanding then please share some more details, so we will look into it and will guide you accordingly.

Best Regards,

Hi Team,


We’re still seeing the Issue, For a better convenience I monitored the memory raise and attached code, exe and sample files i used.
Here are memory consumption statistics.

Working Set(Memory) Memory(Private Working Set) Peak Working Set(Memory)
1. Before Loading Aspose 7492k 1500k 7492k
2. After loading license 14728k 4152k 14888k
3.After html file conversion 175924k 146144k 193356k
4. After disposal(5 mins) 175924k 146144k 193356k
5. Forced GC 145072k 115204k 193356k

At point 4, when we repeated the conversion multiple times, the memory rise upto 253,692k, however it came down to 175924k after multiple conversions.

Our concern is with the last row, Garbage collector is not cleaning that amount of memory. we have waited for more than 15 minutes to see whether this memory will be claimed before closing the application.

We are forcing the GC with the help below c# code.
GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
GC.Collect();


We'll be happy if you help us with a better approach, As we're seeing that Aspose Document Object is not being disposed properly.


Thanks,
Shanthi

Hi Shanthi,


Thanks for sharing additional information. I am testing the scenario and will update you shortly.

Best Regards,

Hi Shanthi,


We are sorry for the inconvenience. After initial testing we have logged a ticket PDFNET-41652 in our issue tracking system for further investigation of memory leak issue in PDF conversion. We will keep you updated about the issue resolution progress within this forum thread.

Best Regards,