Bug 25702 - HSSF outofmemory exception on 1000 x 50 sheet
Summary: HSSF outofmemory exception on 1000 x 50 sheet
Status: RESOLVED INVALID
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 1.5.1
Hardware: Other Linux
: P3 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-12-22 16:09 UTC by gaga
Modified: 2004-11-16 19:05 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gaga 2003-12-22 16:09:04 UTC
Hello, i am using:

redhat linux enterprise
weblogic6.1
java 1.3.1

When generating a 1000+ row x 54 col excel sheet using HSSF, the java servlet 
throws an outofmemory exception everytime (if i do one with 600 rows or less, 
it works fine). This is the first time i am using hssf and I followed the 
tutorial code:

HSSFRow title = sheet.createRow((short)0);
title.createCell((short)0).setCellValue("columnname1");
title.createCell((short)1).setCellValue("columnname2");
......etc.....
title.createCell((short)54).setCellValue("columnname53");

ResultSet rs = getresultset();
int rowcount=1;
rs = executeQuery(sql); //get resultset, leftout some jdbc codes
while (rs.next()) //has 1000+ rows
{
      HSSFRow datarow = sheet.createRow((short)rowcount);
      rowcount++;
      for(int colcount=0; colcount<55;colcount++)
      {	
	datarow.createCell((short)colcount).setCellValue(rs.getString
(colcount+1));
      }
}

Here's memory usage log file from 2 tries, both resulted in outofmemory:

[GC 13773K->10735K(32640K), 0.0287972 secs]
<Dec 22, 2003 10:04:35 AM EST> <Debug> <DEBUG> <*********************FIRST FOR 
LOOP:0> 
......
<Dec 22, 2003 10:07:04 AM EST> <Debug> <DEBUG> <CELL COUNT:50 CELL 
VALUE:0>  //*****Note this row never finished, cell count should reach 54 like 
every other row.
[Full GC 32639K->29327K(32640K), 1.8477303 secs]
[Full GC 29327K->29289K(32640K), 1.8480125 secs]
<Dec 22, 2003 10:07:08 AM EST> <Error> <HTTP> <[WebAppServletContext
(2438883,yyy,/yyy)] Servlet failed with Exception
java.lang.OutOfMemoryError
	<<no stack trace available>>


--------------


[GC 11797K->8490K(32640K), 0.0076758 secs]
[GC 11818K->8461K(32640K), 0.0067751 secs]
<Dec 22, 2003 10:15:11 AM EST> <Debug> <DEBUG> <*********************FIRST FOR 
LOOP:0>
.......
<Dec 22, 2003 10:17:12 AM EST> <Debug> <DEBUG> <CELL COUNT:54 CELL VALUE:0> 
[Full GC 30728K->27639K(32640K), 1.7628752 secs]
[Full GC 32457K->28945K(32640K), 2.1956773 secs]
[Full GC 28945K->28945K(32640K), 1.7103354 secs]
<Dec 22, 2003 10:17:19 AM EST> <Error> <HTTP> <[WebAppServletContext
(2438883,yyy,/yyy)] Servlet failed with Exception
java.lang.OutOfMemoryError
	<<no stack trace available>>


From the log it seems the machine is not out of memory? I am really not sure 
what is going on with hssf now. Please help, thank you

gaga
Comment 1 Avik Sengupta 2003-12-22 16:18:26 UTC
Please start your JVM with more memory. 
http://java.sun.com/j2se/1.3/docs/tooldocs/linux/java.html

While POI obviously needs a significant amount of memory to create large files,
this is not a bug, and resolving Out of Memroy errors have nothing to ddo with POI.