https://issues.apache.org/bugzilla/show_bug.cgi?id=50993
Summary: OutOfMemory Exception on Large docx
Product: POI
Version: 3.7
Platform: PC
Status: NEW
Severity: blocker
Priority: P2
Component: XWPF
AssignedTo: [email protected]
ReportedBy: [email protected]
Loading the attached document with
org.apache.poi.xwpf.usermodel.XWPFDocument(InputStream is) causes an
OutOfMemory Exception with 4GB of heap space but with 8GB it does work. We use
POI in an Application Server and multiple users using the system will cause
this problem more frequently. I realize it is a ~23k page document and it
seems to take some time to load into any editor.
Example Stack Trace:
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3039)
at org.apache.xmlbeans.impl.store.Cur$CurLoadContext.attr(Cur.java:3060)
at
org.apache.xmlbeans.impl.store.Locale$SaxHandler.startElement(Locale.java:3254)
at
org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportStartTag(Piccolo.java:1082)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseAttributesNS(PiccoloLexer.java:1802)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseOpenTagNS(PiccoloLexer.java:1521)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseTagNS(PiccoloLexer.java:1362)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXMLNS(PiccoloLexer.java:1293)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.parseXML(PiccoloLexer.java:1261)
at
org.apache.xmlbeans.impl.piccolo.xml.PiccoloLexer.yylex(PiccoloLexer.java:4808)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yylex(Piccolo.java:1290)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.yyparse(Piccolo.java:1400)
at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:714)
at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3439)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1270)
at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1257)
at
org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
at
org.openxmlformats.schemas.wordprocessingml.x2006.main.DocumentDocument$Factory.parse(Unknown
Source)
at
org.apache.poi.xwpf.usermodel.XWPFDocument.onDocumentRead(XWPFDocument.java:135)
at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:190)
at org.apache.poi.xwpf.usermodel.XWPFDocument.<init>(XWPFDocument.java:114)
at LoadBigDoc.main(LoadBigDoc.java:12)
Example Code:
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
public class LoadBigDoc {
public static void main(final String[] args) throws Exception {
final InputStream is = new BufferedInputStream(new FileInputStream(new
File("ANA3.blast.docx")));
new XWPFDocument(is);
}
}
This code assumes it is run with the correct classpath and the file is in the
current working directory.
Platforms:
Windows 7 64-bit
Mac OS X 10.6.7 64-bit
RHEL 5.5 64-bit
All running Sun JDK 1.6.0_20 64-bit
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]