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(); } }
Created attachment 14516 [details] Example of excel file that reliably fails with OutOfMemoryError Zipped version of Excel file
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.
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.