Bug 34067

Summary: OutOfMemoryError w/ Certain excel files
Product: POI Reporter: Bob White <bobwhite>
Component: HSSFAssignee: POI Developers List <dev>
Status: CLOSED INVALID    
Severity: normal    
Priority: P2    
Version: 2.5-FINAL   
Target Milestone: ---   
Hardware: Other   
OS: AIX   
Attachments: Example of excel file that reliably fails with OutOfMemoryError

Description Bob White 2005-03-18 03:38:20 UTC
I have several Excel files that throw OutOfMemoryError.  Error is reliably
repeatable.  They also seem to take an inordinate amount of time to load before
failing.  This does not happen with smaller size files, hence, I suspect it is a
file format problem.  I do not know what version of Excel is used to create
these files (we are emailed such a data file every day).  I will attempt to
attach an example of a failing file.  Failure occurs in HSSFWorkbook
constructor, called as shown below.

  public XlsHssfWorkbook( final File f ) throws IOException
  {
    boolean bComplete = false;
    _fis = new FileInputStream( f );
    try
    {
      _fs = new POIFSFileSystem( _fis );
      _workbook = new HSSFWorkbook( _fs );
      bComplete = true;
    }
    finally
    {
      if ( !bComplete )
        close();
    }
  }
Comment 1 Bob White 2005-03-18 03:46:07 UTC
Created attachment 14516 [details]
Example of excel file that reliably fails with OutOfMemoryError

Zipped version of Excel file
Comment 2 Andy Oliver 2005-03-18 04:53:28 UTC
Up your heap size (-Xmx384m for instance would make it 384mb).  It makes total
sense that it would get dog slow before dying...its the garbage collector trying
to make due.
Comment 3 Bob White 2005-03-18 12:03:37 UTC
Could it really be that simple?  Did I just need to increase my JVM max heap
size? Yes, it was that simple.  -Xmx128m did the trick.  Never mind.