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 2013/11/12 13:11:07 UTC

[Bug 55769] New: Out of Memory Error while reading .Xlsx file

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

            Bug ID: 55769
           Summary: Out of Memory Error while reading .Xlsx file
           Product: POI
           Version: 3.9
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: ctvipin007@gmail.com

Hi,

I am using Apache POI for reading .xlsx files, using POI 3.9 version jar files.
While reading the excel file I am getting out of memory error, and also it
creates some .txt,.phd files in the folder.
Data in Excel file  is only 100 rows. Error is given below.

<<
JVMDUMP006I Processing dump event "systhrow", detail
"java/lang/OutOfMemoryError" - please wait.
JVMDUMP032I JVM requested Heap dump using
'/dsProjects/Scripts/C_Analysis/heapdump.20131112.064446.57043.0001.phd' in
response to an event
JVMDUMP010I Heap dump written to
/dsProjects/Scripts/C_Analysis/heapdump.20131112.064446.57043.0001.phd
>>

Also I am using XSSF Workbook. Is there any idea to resolve this issue? 
Is there any function available like Dispose() for resolving this issue?

-- 
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


[Bug 55769] Out of Memory Error while reading .Xlsx file

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
If you're not sure how to use the SAX parser, ask on the user list. If you've
found a bug in the SAX parser, please raise a new bugzilla entry for that. As
it stands, you just need to either increase your heap size to something
sensible, or use SAX

-- 
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


[Bug 55769] Out of Memory Error while reading .Xlsx file

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

CTcreations <ct...@gmail.com> changed:

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

--- Comment #4 from CTcreations <ct...@gmail.com> ---
Am using this code...But it cannot[Neglect] empty cell... Is there any idea to
get null cell in the following code ???

....void parseExcel(File file) throws IOException 
    {

  OPCPackage container;
        try 
        {
            container = OPCPackage.open(file.getAbsolutePath());
            ReadOnlySharedStringsTable strings = new
ReadOnlySharedStringsTable(container);
            XSSFReader xssfReader = new XSSFReader(container);
            StylesTable styles = xssfReader.getStylesTable();
            XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)
xssfReader.getSheetsData();

            while (iter.hasNext()) 
            {

                InputStream stream = iter.next();
                processSheet(styles, strings, stream);
                stream.close();

            }


    protected static void processSheet(StylesTable styles,
ReadOnlySharedStringsTable strings, InputStream sheetInputStream) throws
IOException, SAXException 
    {

        InputSource sheetSource = new InputSource(sheetInputStream);
        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
        try 
        {
            SAXParser saxParser = saxFactory.newSAXParser();
            XMLReader sheetParser = saxParser.getXMLReader();
            ContentHandler handler = new XSSFSheetXMLHandler(styles, strings,
new SheetContentsHandler() 
            {

                @Override
                public void startRow(int rowNum) 
                {
                    //System.out.println("")

                }
                @Override
                public void endRow() 
                {
                    stringList.add("Row");
                }
                @Override
                public void cell(String cellReference, String formattedValue) 
                {
                    System.out.println(formattedValue);
                }
                @Override
                public void headerFooter(String text, boolean isHeader, String
tagName) 
                {
                    System.out.println(isHeader?"Header " +text:"Footer "+text
);
                }

            }, 
            false//means result instead of formula
            );
            sheetParser.setContentHandler(handler);
            sheetParser.parse(sheetSource);
        } 
        catch 
        {

-- 
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


[Bug 55769] Out of Memory Error while reading .Xlsx file

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

CTcreations <ct...@gmail.com> changed:

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

--- Comment #2 from CTcreations <ct...@gmail.com> ---
But when I use the SAX parser , it can't take null valued cell..

-- 
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


[Bug 55769] Out of Memory Error while reading .Xlsx file

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #5 from Nick Burch <ap...@gagravarr.org> ---
My previous comment still stands:

If you're not sure how to use the SAX parser, ask on the user list. If you've
found a bug in the SAX parser, please raise a new bugzilla entry for that.For
*this* bug, you just need to either increase your heap size to something
sensible, or use SAX properly

-- 
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


[Bug 55769] Out of Memory Error while reading .Xlsx file

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
The default JVM heap size is very small. You either need to increase it to a
more sensible size, or if you really are constrained to a tiny heap, switch to
SAX based parsing (as detailed on the website)

-- 
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