we had some OutOfMemoryExceptions at saving pptx files. We use pptx files as templates, change some information (mainly replace some text) and save the new pptx file. Unfortunately, we can't reproduce the Exception. The same template with the same data doesn't make trouble if we try to reproduce it after an exception occurs. There is no memory leak - the memory gets freed after each exception. The maximum heap size is 4096 MB, the pptx template has 20 slides and a size of 2.5 MB. The generated pptx file has also 20 slides (none removed or created) and circa the same size (2.5 MB). I'm not allowed to share the template because it's confidential, sorry. Any suggestions are greatly appreciated.
This is the code we use for saving:
- Code: Select all
File file = new File(fileNameForGeneratedReport);
FileOutputStream outStream = new FileOutputStream(file);
Save save = new Save(presentationMLPackage);
save.save(outStream); // <-- Exception occurs here
outStream.flush()
The stack trace (always the same):
- Code: Select all
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2453)
at java.util.Arrays.copyOf(Arrays.java:2427)
at java.util.ArrayList.grow(ArrayList.java:254)
at java.util.ArrayList.ensureExplicitCapacity(ArrayList.java:228)
at java.util.ArrayList.ensureCapacityInternal(ArrayList.java:220)
at java.util.ArrayList.add(ArrayList.java:452)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.buildTypes(ContentTypeManager.java:731)
at org.docx4j.openpackaging.contenttype.ContentTypeManager.marshal(ContentTypeManager.java:786)
at org.docx4j.openpackaging.io3.stores.ZipPartStore.saveContentTypes(ZipPartStore.java:213)
at org.docx4j.openpackaging.io3.Save.save(Save.java:176)
docx4j version: 3.2.1
we use a ibm java version, that comes with a WebSphere Application Server:
- Code: Select all
<prompt>:~>/<path to java>/java_1.7_64/bin/./java -version
java version "1.7.0"
Java(TM) SE Runtime Environment (build pxa6470sr9fp60ifix-20161110_01(SR9 FP60)+IV90630+IV90578))
IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20161005_321282 (JIT enabled, AOT enabled)
J9VM - R26_Java726_SR9_20161005_1259_B321282
JIT - tr.r11_20161001_125404
GC - R26_Java726_SR9_20161005_1259_B321282_CMPRSS
J9CL - 20161005_321282)
JCL - 20161021_01 [b]based on Oracle jdk7u121-b15[/b]