A memory leak occurred during the process of pdf generating images

public static void main(String[] args) {
Document pdfDocument = new Document(“eead286f80687373604c64bdcc0f7f6b”);
try {
for (int pageCount = 1; pageCount <= pdfDocument.getPages().size(); pageCount++) {
// Create stream object to save the output image
String outputFilePath = “aaa.jpg”;

            final Instant now = Instant.now();
            java.io.OutputStream imageStream = new java.io.FileOutputStream(outputFilePath);

            Resolution resolution = new Resolution(300);
            JpegDevice JpegDevice = new JpegDevice(resolution);

            JpegDevice.process(pdfDocument.getPages().get_Item(pageCount), imageStream);
            imageStream.close();
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

image.png (229.2 KB)

JDK1.8 aspose.pdf 21.6

@zyx

I have been able to reproduce the issue on our end. A ticket with ID PDFJAVA-40664 has been created in our issue tracking system to further investigate the issue on our end. This thread has been linked with the issue so that you may be notified once the issue will be fixed.