Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

ES4 Memory Leak?

Avatar

Level 1

We recently upgraded to ES4 in our application where we do Tiff2PDF conversions through the API

The Java heap on the Application Server (WAS) grows over time, where we now proactively recycle.  We did not make any implemenation changes to the API for the ES4 upgade, are there any known changes needed that may be causing this leak?

Below is the API example and a visual of the heap growth.

Mike

adobe.01.jvm.04.01.2015.PNG

//Convert Tiff To Pdf
        try
        {
fileInputStream = new FileInputStream( imageFolderLocation + tiffFileName );
inputDocument = new Document( fileInputStream );
CreatePDFResult result = generatePdfServiceClient.createPDF( inputDocument, tiffFileName, "Standard", "Standard OCR", null, null, null );
resultDocument = new Document( result.getCreatedDocument().getInputStream() );
resultDocument.copyToFile( new File( outputFileName ) );
        }
        finally
        {
              fileInputStream.close();
       }

//merge converted pdfs into single document
mergeDdx =
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result="MergedPDFResult">
<PDFGroup>
<NoForms/>
<PDF source="DocList"/>
</PDFGroup>
</PDF>
</DDX>

        List<Document> pdfInputs = new ArrayList<Document>();
        for( String pdfInputFileName : pdfInputFileNames )
        {
            Document document = new Document( new File( pdfInputFileName ), true );
            pdfInputs.add( document );
        }

        Map<String, Object> assemblerInputs = new HashMap<String, Object>();
        assemblerInputs.put( "DocList", pdfInputs );

        AssemblerOptionSpec assemblerSpec = new AssemblerOptionSpec();
        assemblerSpec.setFailOnError( true );

        try
        {
            AssemblerResult jobResult = assemblerServiceClient.invokeDDX(mergeDdx, assemblerInputs, assemblerSpec );
            mergedDocument = this.extractDocumentFromResult( jobResult );

            mergedDocument.copyToFile( new File( mergedDocumentFileName ) );
            mergedDocument.dispose();

            for( Document document : pdfInputs )
            {
                document.dispose();
            }
        }
        catch( OperationException oe )
        {
            PdfConversionServiceImpl.LOGGER
                    .error( "Could not assemble PDF document." );
            String message = this.getExceptionContents( oe );
            FormsException fe = new FormsException( message );
            throw new FormsException( "Could not assemble PDF document.", fe );
        }

1 Reply