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

Free Support Forum - aspose.com

HTML to PDF using Aspose.HTML - taking lot of memory

We have paid license and we are using Aspose.HTML 22.3 to convert HTML to PDF. It takes a lot of memory for the conversion and once conversion is complete, there are lots of Aspose.HTML objects remain in memory and even not cleaned my GC. It takes around 80 to 100 MB for one file and memory consumption keeps increasing into GBs on production until we restart out service

@trentz

Could you please ZIP and attach your input HTML here for testing? We will investigate the issue and provide you more information on it.

SampleApp.zip (2.5 MB)
Please find attached sample code

@trentz

We have converted ten HTML documents to PDF using your code example at Windows 10 and have not found the shared issue. Please check the attached image.
image.png (58.4 KB)

Issue is with memory consumption and memory cleanup. Memory consumption gets increasing when we process multiple files and once all files are converted and we don’t close EXE, Appose.HTML objects still remains in memory unclaimed by GC even calling Dispose() method.

please check memory usage by Diagnostic Tool in Visual Studio.

@trentz

Please note that objects will be cleaned up when they are no longer being used and when the garbage collector sees fit. Sometimes, you may need to set an object to null in order to make it go out of scope but overall there is usually no need to set to null or call Dispose method.

When the converter object is closed, all the data is purged from memory during the next garbage collector cycle.

Please note that the memory may not be released until you close the application.

But this is the issue - memory may not be released until we close the application. we are using Windows service to convert files and we can’t restart window service every time we process the file. We are also using Aspose.PDF and its working fine - memory is release as soon as processing is complete.

Please uncomment function for Aspose.PDF in my sample App and then use it in place of Aspose.HTML, memory consumption will be very low.

@trentz

We have logged this problem in our issue tracking system as HTMLNET-3712. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.