We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Java heap space memory issues on pptx with 1 slide

Hi I have been trying out Aspose.slides to see how good it renders powerpoints to images as one of our customers is in need of a product that does a better job than the freely available libraries. The problem I encountered was that on the first try I got java heap space error on the codeline PresentationEx ppt = new PresentationEx(file); even if I reduced the test pptx file to only 1 slide and even after doubling my heap space size.

Is this normal?

Regards,

Eric


Hi Eric,


Thanks for your interest in Aspose.Slides.

Can you please share what heap size you have been using on your end and which version of Aspose.Slides for Java you are using on your end. I would suggest you to please try using heap size from 256 to 512 MB for average size presentations. Secondly, there is minimum memory requirement as well for Aspose.Slides for Java to load the Document Object Model (DOM) in memory. The rest of memory consumption depends upon size of presentations, number of slides in that and content inside the presentation. Please share, if I may help you further in this regard.

Many Thanks,

Hi,

thanks for the fast reply.

My heap size is configured to 512MB. My OS is Mac OSX 10.8.3, JDK 1.6 (for Mac) and I run everything in Eclipse Juno.

In the test I did I had reduced the pptx to only 1 slide to see if I still had the issue and unfortunately I did.

Some simple presentations I created myself work fine but all my customer pptx files crash on the constructor with memory issues :-s

So this seems weird and of course I cannot tell the marketing director who provided me the slides that he needs to redo them all, as you can imagine.

Cheers,

Eric

Hi Eric,


Thanks for further elaboration from your side. Can you please share the sample presentations with us along with us along with information that which version of Aspose.Slides for Java you are using on your end. Please share the stack trace and use sample code with us as well. I will investigate the issue further on my end to help you out.

Many Thanks,

Sorry, forgot to mention that I am testing the latest version, i.e. 7.3.0.



Concerning the powerpoints I am testing with, these are confidential to my customer so it is a big issue to share it. I would like to provide you some samples but I cannot attach them to this public post, is there a more private way to send you this?



The code I am running is:



String file=“demo.pptx”;

String prefix=“slide”;

PresentationEx ppt = new PresentationEx(file); //(this is line 139 in my code, I cannot get past it for most files)

for (int i = 0; i
//Accessing a slide using its slide position

SlideEx slide = ppt.getSlides().get_Item(i);//getSlideByPosition(slidenum);

String title = slide.getName();



//Getting the thumbnail image of the slide of a specified size

BufferedImage img = slide.getThumbnail(new Dimension (1024, 768));



// save the result

String fname=prefix + (i + 1) +".png";

FileOutputStream out = new FileOutputStream(fname);

ImageIO.write(img, “png”, out);

out.close();

}





Concerning the stack traces, here are a few examples of errors I get:



Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at com.aspose.slides.pa2137a2a.pbdb106a0.fh.do(Unknown Source)

at com.aspose.slides.Collections.Hashtable.(Unknown Source)

at com.aspose.slides.Collections.Hashtable.(Unknown Source)

at com.aspose.slides.Collections.Hashtable.(Unknown Source)

at com.aspose.slides.zs.(Unknown Source)

at com.aspose.slides.btq.(Unknown Source)

at com.aspose.slides.btt.do(Unknown Source)

at com.aspose.slides.btt.do(Unknown Source)

at com.aspose.slides.btt.(Unknown Source)

at com.aspose.slides.btu.do(Unknown Source)

at com.aspose.slides.btu.(Unknown Source)

at com.aspose.slides.btu.(Unknown Source)

at com.aspose.slides.PresentationEx.do(Unknown Source)

at com.aspose.slides.PresentationEx.int(Unknown Source)

at com.aspose.slides.PresentationEx.if(Unknown Source)

at com.aspose.slides.PresentationEx.(Unknown Source)

at com.aspose.slides.PresentationEx.(Unknown Source)

at com.qtree.commons.io.ppt.AsposeExPowerPointToImageConvertor.main(AsposeExPowerPointToImageConvertor.java:139)



================

Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at java.util.Arrays.copyOf(Arrays.java:2786)

at sun.misc.IOUtils.readFully(IOUtils.java:43)

at java.util.jar.JarFile.getBytes(JarFile.java:369)

at java.util.jar.JarFile.getManifestFromReference(JarFile.java:162)

at java.util.jar.JarFile.getManifest(JarFile.java:149)

at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:696)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:228)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2398)

at java.lang.Class.getConstructor0(Class.java:2708)

at java.lang.Class.getConstructor(Class.java:1659)

at com.aspose.slides.chs.do(Unknown Source)

at com.aspose.slides.chs.do(Unknown Source)

at com.aspose.slides.bdz.(Unknown Source)

at com.aspose.slides.bdb.for(Unknown Source)

at com.aspose.slides.bdb.(Unknown Source)

at com.aspose.slides.PresentationEx.int(Unknown Source)

at com.aspose.slides.PresentationEx.if(Unknown Source)

at com.aspose.slides.PresentationEx.(Unknown Source)

at com.aspose.slides.PresentationEx.(Unknown Source)

at com.aspose.slides.PresentationEx.(Unknown Source)

at com.qtree.commons.io.ppt.AsposeExPowerPointToImageConvertor.main(AsposeExPowerPointToImageConvertor.java:139)

==================



Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at java.nio.CharBuffer.wrap(CharBuffer.java:350)

at java.nio.CharBuffer.wrap(CharBuffer.java:373)

at java.lang.StringCoding$StringDecoder.decode(StringCoding.java:138)

at java.lang.StringCoding.decode(StringCoding.java:173)

at java.lang.String.(String.java:443)

at java.util.jar.Attributes.read(Attributes.java:401)

at java.util.jar.Manifest.read(Manifest.java:232)

at java.util.jar.Manifest.(Manifest.java:50)

at java.util.jar.JarFile.getManifestFromReference(JarFile.java:163)

at java.util.jar.JarFile.getManifest(JarFile.java:149)

at sun.misc.URLClassPath$JarLoader$2.getManifest(URLClassPath.java:696)

at java.net.URLClassLoader.defineClass(URLClassLoader.java:228)

at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

at com.aspose.slides.PictureEx.do(Unknown Source)

at com.aspose.slides.PictureEx.do(Unknown Source)

at com.aspose.slides.aao.do(Unknown Source)

at com.aspose.slides.aao.if(Unknown Source)

at com.aspose.slides.aao.(Unknown Source)

at com.aspose.slides.GeometryShapeEx.do(Unknown Source)

at com.aspose.slides.GeometryShapeEx.for(Unknown Source)

at com.aspose.slides.PictureFrameEx.do(Unknown Source)

at com.aspose.slides.GroupShapeEx.do(Unknown Source)

at com.aspose.slides.GroupShapeEx.do(Unknown Source)

at com.aspose.slides.SlideEx.do(Unknown Source)

at com.aspose.slides.SlideEx.do(Unknown Source)

at com.aspose.slides.SlideEx.getThumbnail(Unknown Source)









Cheers,



Eric

I cannot get the for loop in my code to show up properly in the post.



The for loop is as simple as it gets:



for (int i = 0; i < ppt.getSlides().getCount(); i++) {

Attached 2 presentations:



the ppt version works the pptx version (of the same presentation) crashes with:





Exception in thread “main” java.lang.OutOfMemoryError: Java heap space

at java.awt.image.DataBufferInt.(DataBufferInt.java:41)

at java.awt.image.Raster.createPackedRaster(Raster.java:458)

at java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)

at java.awt.image.BufferedImage.(BufferedImage.java:315)

at com.aspose.slides.pa2137a2a.pbdb106a0.pa2137a2a.b.if(Unknown Source)

at com.aspose.slides.pa2137a2a.pbdb106a0.pa2137a2a.b.(Unknown Source)

at com.aspose.slides.SlideEx.do(Unknown Source)

at com.aspose.slides.SlideEx.getThumbnail(Unknown Source)

at com.qtree.commons.io.ppt.AsposeExPowerPointToImageConvertor.convertPptX2Image(AsposeExPowerPointToImageConvertor.java:107)

at com.qtree.commons.io.ppt.AsposeExPowerPointToImageConvertor.convertPptX2Image(AsposeExPowerPointToImageConvertor.java:65)

at com.qtree.commons.io.ppt.AsposeExPowerPointToImageConvertor.convertPptX2Image(AsposeExPowerPointToImageConvertor.java:34)

at com.qtree.commons.io.ppt.TestPPTConversions.runBatch(TestPPTConversions.java:59)

at com.qtree.commons.io.ppt.TestPPTConversions.main(TestPPTConversions.java:31)

Hi Eric,


I like to share that I have not been able to observe the issue with getCount() method. You can try the following statement on your end.

int cnt=ppt.getSlides().getCount();
for (int i = 0; i <cnt; i++)

Secondly, with shared presentation I have not been able to observe the issue with max heap size 512MB in Windows 7 environment with Java 1.6_35 installed. Can you please try increasing the heap size on your end to 1 G or more where it works. I will then add a performance issue in our issue tracking system based on feedback shared from your working environment.

Many Thanks,

Hi,



these are my eclipse settings:



-startup

…/…/…/plugins/org.eclipse.equinox.launcher_1.3.0.v20120522-1813.jar

–launcher.library

…/…/…/plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20120522-1813

-product

org.eclipse.epp.package.jee.product

–launcher.defaultAction

openFile

-showsplash

org.eclipse.platform

–launcher.XXMaxPermSize

1024m

–launcher.defaultAction

openFile

-vmargs

-Dosgi.requiredJavaVersion=1.5

-Dhelp.lucene.tokenizer=standard

-XstartOnFirstThread

-Dorg.eclipse.swt.internal.carbon.smallFonts

-XX:MaxPermSize=1024m

-Xms128m

-Xmx1024m

-Xdock:icon=…/Resources/Eclipse.icns

-XstartOnFirstThread

-Dorg.eclipse.swt.internal.carbon.smallFonts



I even did a test by creating a JUnit test file and running a maven build with increased heap size to make sure it was not due to eclipse:



export MAVEN_OPTS=-Xmx1024m

mvn clean install -Dmaven.test.skip=false



It resulted in the same heap space error unfortunately. I did the same test for 2G, same result, so I guess there is a memory leak somewhere.



I’ll try to setup a windows VM machine, if I can find the time, with the specs you tested, see if I can reproduce it under the same circumstances (except the OS then) so I can confirm your findings. This might help your developers.



Regards,



Eric

Hi Eric,


That will be perfect as it will help in narrowing down the issue. Please share your findings when you have observed in Windows environment. I have created an issue with ID SLIDESJAVA-33879 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 automatically notified once the issue will be resolved.

We are sorry for your inconvenience,

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.