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

Free Support Forum - aspose.com

Memory Leak in aspose pdf java

Hi,


We are encountering a memory leak while converting PDF documents to html. The issue persists even after increasing java heap memory from 2GB to 3GB.

The number of documents being processed is huge. This is very high priority for us. Any help would be highly appreciated.

Hello Vinay,


Thanks for using our API’s.

If you are processing huge number of documents, then you can use MemoryCleaner object to clean the memory after completion of the process. After completing operations with Aspose.Pdf object you can close object with close() or dispose() methods and finally use com.aspose.pdf.MemoryCleaner.clear() method, It clears Aspose.Pdf specific instances and will enables you to effective memory usage.

Please note it is recommended that you should call this method only if there is a shortage of available memory. Please find sample code to check memory status.

Runtime rt = Runtime.getRuntime();
long max = rt.maxMemory()/1048576;
long total = rt.totalMemory()/1048576;
long free = rt.freeMemory()/1048576;
long used = total - free;

<div style=“font-family: “Times New Roman”; color: rgb(0, 0, 0); font-size: medium;”>However if the issue persist then please share here your sample files and working code, so we will test the scenario and will guide you accordingly.
<div style=“font-family: “Times New Roman”; color: rgb(0, 0, 0); font-size: medium;”>
Best Regards,