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

Free Support Forum - aspose.com

Aspose Pdf memory leak when converting document from PDF to DOCX format

We have tried a simple java program, which read a pdf file, then run a for loop (x 10000 times) to convert PDF to DOCX by calling com.aspose.pdf.Document.save(), using DocSaveOptions.RecognitionMode.Flow

We monitored the running java program (source code and the pdf file is attached as aspose-memory-test.zip) using JDK’s tool “jconsole”, and observed that the used memory (heap size) is keep growing, from less than 1GB to over 4GB, and got “java.lang.OutOfMemoryError: GC overhead limit exceeded” after running 2696 times

Environment information:

  • JDK / JRE version: 1.8.0_231
  • Aspose.Pdf version: 20.11 (jdk17)
  • Operating System:
    • Microsoft Windows Server 2019 Standard
    • Microsoft Windows 10 Pro

aspose-memory-test.zip (219.2 KB)

jconsole-heap.png (282.9 KB)


We have logged an issue as PDFJAVA-39958 in our issue tracking system after replicating it in our environment. We will surely look into its details and keep you posted with the status of its correction. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-39958) have been fixed in Aspose.PDF for Java 21.8.