PPTX to PDF: Memory leak in slides module (Java)

Our Transformation Service runs OutOfMemory every night. This happens after the migration to Slides version 19.12 (from 19.4 over 19.8). The class “com.aspose.slides.internal.ia.b” allocates 2.2 GB memory.

Attachment contains a heap dump analyzer output:
screenshot.png (79.1 KB)

Code snippet:

public FileEntity convert( MediaType mediaType,  File source,
                           MediaType targetMediaType,
                           Map<String, Object> parameter ) throws IOException, WebApplicationException {

    Integer saveFormat = this.exporter.get( targetMediaType );
    File target = getTempOutputFile( targetMediaType );

    try ( InputStream is = new FileInputStream( source ) ) {
        
        Presentation doc = new Presentation( is );

        try {
            String compliance = (String) parameter.get( ConvertParameter.PDFA_COMPLIANCE );

            if ( targetMediaType.isCompatible( PDF ) ) {
                PdfOptions options = new PdfOptions();
                if ( compliance != null ) {
                    options.setCompliance( PdfCompliance.PdfA1b );
                }
                // embed fonts
                Boolean embedFonts = ( Boolean ) parameter.get( InternalParameter.EMBED_FONTS );                
                if ( compliance != null || ( embedFonts != null && embedFonts.booleanValue() ) ) {
                    options.setEmbedTrueTypeFontsForASCII( true );                
                }
                doc.save( target.getAbsolutePath(), saveFormat, options );
            } else {
                doc.save( target.getAbsolutePath(), saveFormat );
            }
            return new FileEntity( targetMediaType, target );
        } finally { 
            doc.dispose();
        }

    } catch ( Exception e ) {
      ...
    }
}

@depi,

I have observed the issue shared by you and request you to please try using latest Aspose.Slides for Java 20.1 on your end. In case you still feel there is a memory leak, please provide the source presentation, generated output (if any), Operating System and Java details on your end along with memory leak profile obtained. We will investigate this further on our end to help you out.

Mainly documents are converted to PDF, PDF/A and TIFF. One slides document is used for many tests.

slides.zip (513.2 KB)

The problem can be found on both Windows Server 2016/2019 and Linux (CentOS/SUSE). Now we use the Aspose Slides 20.1 module.
The code just open the Presentation and saves the document to PDF/TIFF. (see last comment, code sample)

@depi,

Thank you for sharing the information with us. An issue with ID SLIDESJAVA-38056 has been created in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.

The issues you have found earlier (filed as SLIDESJAVA-38056) have been fixed in this update.