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

Free Support Forum - aspose.com

Out of memory exception using Aspose.Pdf

What is the right way to use MemoryClear and dispose?
I am facing out of memory exception using only Aspose.pdf when I try to convert PDF to DOCX.

@cpatricio76

Thanks for contacting support.

In Aspose.Pdf for .NET, memory clearing or object disposing is implemented when you call Document.Save() method. The document object has been disposed automatically after calling its Save() method. Furthermore please note that, when you are dealing with files of large sizes, you need to execute your program/code using x64 mode of debugging.

When your program targets x64 mode of debugging, it has access to full memory, which is installed in your environment. Please try using x64 mode of debugging and if you still face any issue, please share your sample input document. We will test the scenario in our environment and address it accordingly.

Best Regards,
Asad Ali

Hmmm I am using Aspose.Pdf for Java v17.6.

Does the same explanation apply to Aspose.Pdf for Java?

How to enable x64 debug in Java?

@cpatricio76

Thanks for writing back and sharing more details.

Even in Aspose.Pdf for Java, same routine for disposing object has been implemented in the API.

Furthermore, the memory consumption by your program/code depends upon the Java Version (e.g 1.7, 1.8), which you are using. The new or latest version of JDK have access to more of the memory than lower or previous versions do.

We will really appreciate if you can please share your sample input document, so that we can test the scenario in our environment and address it accordingly. Currently forums support upload size up-to 3MB and in case your document is larger, you can upload it to some public file sharing service (e.g dropbox) and share the link here.

Best Regards,
Asad Ali

@asad.ali

Please see attached the test source code, files, output console and more.
It is weird a NullPointerException in some Aspose.Pdf class that I couldn’t figure it out what because of some obfuscator software.

powerpoint to doc.zip (2.7 MB)

@cpatricio76

Thanks for sharing the sample file(s).

I have tested the scenario using Aspose.Pdf for Java 17.6 and Aspose.Slides for Java 17.6 and observed that Aspose.Slides was not generating correct PDF file which was why the API Aspose.Pdf for Java was throwing an exception of “incorrect file format”. Would you please share, which version of Aspose.Slides you are using. So that we can test the scenario again in our environment and address it accordingly.


Best Regards,
Asad Ali

@asad.ali

I am using Aspose.Slides for Java v17.6.

@cpatricio76

Thanks for sharing more details with us.

I have again tested the scenario in an environment (i.e Windows 10 EN x64, Eclipse Neon.2 Release 4.6.2, 8GB of RAM, JDK 1.8) and was unable to notice out of memory exception. The API generated DOCX file(s) without throwing any exception. For your reference, I have also attached generated output files over our end.

Output Files

We will really appreciate if you can please share your environment details, as this would really help us in replicating the issue in our environment and address it accordingly.


Best Regards,
Asad Ali