OutOfMemoryError When Exporting Slides to HTML in Java (1546cnc)

Hello,

I am trying to save each slide of the attached presentation as HTML file, without success. It throws OutOfMeory Excepton for Java Heap space. Slides Java library version is 24.3, and I was able to give the java process up to 26 GB, but it did not help.
Attached s the presentation as well as the test code needed to reproduce the issue.
Fell free to ask for any additional info, if needed.
aspose.java.txt.zip (1012 Bytes)

Link to presentation file
Kind regards,
Zeljko

@Zeljko

It seems you’re encountering an OutOfMemoryException while trying to save a PPTX presentation as HTML using Aspose.Slides. Here are a few suggestions to help you resolve this issue:

  1. Increase Java Heap Size: Although you’ve already allocated 26 GB, ensure that your Java Virtual Machine (JVM) is configured correctly to utilize this memory. Verify your JVM options to confirm that the heap size is set properly.

  2. Optimize Presentation: If the presentation contains large images or complex elements, consider optimizing it by reducing image sizes or simplifying the content before conversion.

  3. Process Slides Individually: Instead of converting the entire presentation at once, try saving each slide as a separate HTML file. This can help manage memory usage more effectively. Here’s a sample code snippet to save each slide individually:

    Presentation presentation = new Presentation("your_presentation.pptx");
    for (int i = 0; i < presentation.getSlides().size(); i++) {
        ISlide slide = presentation.getSlides().get(i);
        String htmlFileName = "slide_" + (i + 1) + ".html";
        slide.writeAsHtml(htmlFileName);
    }
    
  4. Use a Different Format: If the issue persists, consider converting the presentation to a different format first (like PDF) and then to HTML, as this might reduce memory consumption.

If these suggestions do not resolve the issue, you may want to consult the Aspose documentation or community forums for further assistance.

@Zeljko,
Thank you for contacting free support. I need some time to investigate the issue. I will get back to you as soon as possible.

@Zeljko,
Thank you for your patience. I reproduced an OutOfMemoryError when converting the presentation slides to HTML with Aspose.Slides for Java 24.3, but the error does not appear with version 25.10. We recommend using the latest version of Aspose.Slides for Java.

Thank you @andrey.potapov ,
it does work with 25.10. Although, it takes more-less 3 minutes to wrap the test with the same amount of memory available…

To re-phrase myself, it takes nowhere near the maximum of 26GB of available memory, plus the CPU seems to be in idle for several periods of time during the process.

@Zeljko,
Thank you for the notes. Please share the following additional information:

  • The OS version on which the problem is observed.
  • The target JDK version used in your application project.

OS: 22.04.1-Ubuntu
JDK: openjdk 17.0.6 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)
maven JDK source and target: 17
maven: Apache Maven 3.6.3

@Zeljko,
Thank you for the additional information. I have reproduced the problem where the PPTX to HTML conversion takes more than three minutes. We apologize for any inconvenience caused.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39740

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@Zeljko,
Could you please also share the Java arguments you are using (xmx, smx, etc.)?