Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

Latest pdf librairy and Java heap space

$
0
0
Hello

We were using the aspose-pdf-4.3.0.jar to transform each page of a pdf file into a jpeg image,
it was working fine with the attached file.

Once we updated the library to
aspose-pdf-9.5.2.jar, it throwing the following error :
java.lang.OutOfMemoryError: Java heap space
Dumping heap to java_pid6228.hprof ...


The code is the following:
          
// create stream object to save the output image
            File ftmp = File.createTempFile("aaa", ".jpg");
            OutputStream imageStream = new FileOutputStream(ftmp);


            // create JPEG device with specified attributes
            // Quality [0-100], 100 is Maximum
            // create Resolution object
            Resolution resolution = new Resolution(300);
            // create JpegDevice object where second argument indicates the quality of resultant
            // image
            JpegDevice jpegDevice = new JpegDevice(resolution, 90);

            // convert a particular page and save the image to stream
            jpegDevice.process(pdfDocument.getPages().get_Item(page), imageStream);

            // close the stream
            imageStream.close();


the file
java_pid6228.hprof contains:

One instance of "com.aspose.pdf.internal.p485.z22" loaded by "org.apache.catalina.loader.WebappClassLoader @ 0x781041ac8" occupies 1 276 798 208 (76,73%) bytes. The memory is accumulated in one instance of "java.lang.Object[]" loaded by "<system class loader>".

Keywords
com.aspose.pdf.internal.p485.z22
java.lang.Object[]
org.apache.catalina.loader.WebappClassLoader @ 0x781041ac8

Any advice?


Viewing all articles
Browse latest Browse all 3131

Trending Articles