OutOfMemoryError while running on open JDK 8

Hi,
Our UAT environment hitting out of memory exception when calling aspose library API functions.
We have tested exact same library, PDF and code version in our integration environment and we did not get any errors.

However our integration environment has 32 GB physical memory and UAT environment has only 16 GB. Application is running on default memory settings and below are the java version details.

Java config
Openjdk version “1.8.0_40”
OpenJDK Runtime Environment (build 1.8.0_40-b25)
OpenJDK Client VM (build 25.40-b25, mixed mode)

**Below are the sample code: and using Aspose 19.3 .jar **

Document pdfDocument = new Document(file.getAbsolutePath());
int totalpageCount = pdfDocument.getPages().size();
system.out.println(totalpageCount);

Please help to fix this issue. Thanks

@bckoh_ncs_com_sg

Thanks for contacting support.

Would you please try using Aspose.PDF for Java 19.7 in your environment. Also, please try increasing Java Heap size in order to resolve out of memory exception. In case you still face any issue, please share your sample PDF document. We will test the scenario in our environment and address it accordingly.