You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2011/11/17 10:27:28 UTC

DO NOT REPLY [Bug 52203] New: java.lang.OutOfMemoryError: Java heap space when reading .xlsx file with 1million rows by using usermodel api

https://issues.apache.org/bugzilla/show_bug.cgi?id=52203

             Bug #: 52203
           Summary: java.lang.OutOfMemoryError: Java heap space when
                    reading .xlsx file with 1million rows by using
                    usermodel api
           Product: POI
           Version: 3.7
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: vanlooon@126.com
    Classification: Unclassified


I try to read .xlsx file of 1 million rows by using usermodel api, the file
size is 11.2 MB, the jvm throw Exception :
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Arrays.java:2786)
    at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
    at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:115)
    at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:55)
    at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:82)
    at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)
    at SXSSFWorkbookTest.test2(SXSSFWorkbookTest.java:51)
    at SXSSFWorkbookTest.main(SXSSFWorkbookTest.java:37)

To resolve the issue, i use the eventmodel api, that is ok!.
But i want to know why the usermodel api take so much memory when parseing huge
rows file???

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52203] java.lang.OutOfMemoryError: Java heap space when reading .xlsx file with 1million rows by using usermodel api

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52203

ronwhite <va...@126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |APIBug

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52203] java.lang.OutOfMemoryError: Java heap space when reading .xlsx file with 1million rows by using usermodel api

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52203

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #2 from Nick Burch <ni...@alfresco.com> 2011-11-17 11:34:05 UTC ---
As discussed many times on the list, the usermodel loads everything into
memory, so you need lots of memory available to hold everything. The event
model just does one little bit at a time, so is much lower memory footprint
(but you can't do random access)

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52203] java.lang.OutOfMemoryError: Java heap space when reading .xlsx file with 1million rows by using usermodel api

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52203

ronwhite <va...@126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #1 from ronwhite <va...@126.com> 2011-11-17 09:34:43 UTC ---
(In reply to comment #0)
> I try to read .xlsx file of 1 million rows by using usermodel api, the file
> size is 11.2 MB, the jvm throw Exception :
code:
                InputStream inp = new FileInputStream("100w.xlsx");
        Workbook wb = WorkbookFactory.create(inp);
exception:
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
>     at java.util.Arrays.copyOf(Arrays.java:2786)
>     at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:94)
>     at
> org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource$FakeZipEntry.<init>(ZipInputStreamZipEntrySource.java:115)
>     at
> org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.<init>(ZipInputStreamZipEntrySource.java:55)
>     at org.apache.poi.openxml4j.opc.ZipPackage.<init>(ZipPackage.java:82)
>     at org.apache.poi.openxml4j.opc.OPCPackage.open(OPCPackage.java:220)
>     at SXSSFWorkbookTest.test2(SXSSFWorkbookTest.java:51)
>     at SXSSFWorkbookTest.main(SXSSFWorkbookTest.java:37)
> To resolve the issue, i use the eventmodel api, that is ok!.
> But i want to know why the usermodel api take so much memory when parseing huge
> rows file???

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 52203] java.lang.OutOfMemoryError: Java heap space when reading .xlsx file with 1million rows by using usermodel api

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52203

ronwhite <va...@126.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |

-- 
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: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org