You are viewing a plain text version of this content. The canonical link for it is here.
Posted to odf-dev@incubator.apache.org by "Nimarukan (JIRA)" <ji...@apache.org> on 2016/05/28 22:29:13 UTC

[jira] [Updated] (ODFTOOLKIT-333) Exception in thread "main" java.lang.OutOfMemoryError

     [ https://issues.apache.org/jira/browse/ODFTOOLKIT-333?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Nimarukan updated ODFTOOLKIT-333:
---------------------------------
    Attachment: odftoolkit-333-test.zip

odftoolkit-333-test.zip packages up bigFile.ods into a quick maven project.
If java and maven are installed, then
{{mvn test}}
should run the test, which simply loads the spreadsheet file and counts the number of rows in the first sheet.

The pom.xml specifies dependencies on odfdom-java-0.8.10 and simple-odf-0.8.1.  Commented out are alternative dependencies for developing with local jars built from svn.

The pom.xml specifies that the test runner use the java command line option {{-Xmx3000M}} to run it with 3000MB maximum memory.  I think the JVM normally defaults to one quarter of system RAM, so specifying this option is necessary to ensure the maximum memory limit is the same on any system.  To see your default MaxHeapSize: 
{{java -XX:+PrintCommandLineFlags -version}}
The test does not throw the OutOfMemoryError with 3000MB, though if the max heap size is less than 2200MB it will slow down due to additional full garbage-collection passes.  It needs more than 1500MB to load this spreadsheet with the given jars.

With the default jars, the test runs slowly.  The test runs in about 1/12 of that time with patches from ODFTOOLKIT-424 (I used approach A patches).



> Exception in thread "main" java.lang.OutOfMemoryError
> -----------------------------------------------------
>
>                 Key: ODFTOOLKIT-333
>                 URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-333
>             Project: ODF Toolkit
>          Issue Type: Bug
>          Components: odfdom, performance, simple api
>    Affects Versions: odfdom-0.8.7, odfdom-0.8.8
>            Reporter: Vicente Villegas Larios
>         Attachments: bigFile.ods, odftoolkit-333-test.zip
>
>
> I have been facing an issue related to "Out of Memory", so I'm trying to read a ODS file with 1.4 MB and ODF code is throwing the following exception.
> Exception in thread "main" java.lang.OutOfMemoryError
> 	at java.util.Arrays.copyOfRange(Unknown Source)
> 	at java.util.Arrays.copyOf(Unknown Source)
> 	at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:105)
> 	at org.odftoolkit.odfdom.pkg.StreamHelper.stream(StreamHelper.java:74)
> 	at org.odftoolkit.odfdom.pkg.StreamHelper.transformStream(StreamHelper.java:48)
> 	at org.odftoolkit.odfdom.pkg.OdfPackage.getBytes(OdfPackage.java:1584)
> 	at org.odftoolkit.odfdom.pkg.OdfPackage.getInputStream(OdfPackage.java:1650)
> 	at org.odftoolkit.odfdom.pkg.OdfFileDom.initialize(OdfFileDom.java:137)
> 	at org.odftoolkit.odfdom.dom.OdfContentDom.initialize(OdfContentDom.java:60)
> 	at org.odftoolkit.odfdom.pkg.OdfFileDom.<init>(OdfFileDom.java:87)
> 	at org.odftoolkit.odfdom.dom.OdfContentDom.<init>(OdfContentDom.java:50)
> 	at org.odftoolkit.odfdom.pkg.OdfFileDom.newFileDom(OdfFileDom.java:110)
> 	at org.odftoolkit.odfdom.pkg.OdfPackageDocument.getFileDom(OdfPackageDocument.java:280)
> 	at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getFileDom(OdfSchemaDocument.java:393)
> 	at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getContentDom(OdfSchemaDocument.java:197)
> 	at org.odftoolkit.simple.Document.getContentRoot(Document.java:762)
> 	at org.odftoolkit.simple.SpreadsheetDocument.getContentRoot(SpreadsheetDocument.java:217)
> I know that ODF files are like zip files, so I changed the extension to "zip" and extracted to a folder, it seems like the folder size is 180MB.
> Beside that I exported the content to a "xls"  file and I used POI to perform the same operation and seemed to work ok with POI. Seems like ODFtoolkit doesn't has support to read big files.
> I notice that the content is stored in a XML file, thinking about it, seems like ODF is using DOM instead of SAX parser. 
> Is there any one who can help me to fix this problem? 
> I'm attaching the "ods" file with the data that throws the out of memory.
> Many thanks



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)