I am currently running a database query and returning a Resultset object of over 12000+ records. I process this resultset into an arraylist of an string arraylist, with each inner arraylist representing a record from the database. Everything works fine until I try to write all this data to an excel file using JExcel. I run the java garbage collector (System.gc()) before the following code, which is where a java.lang.outofmemoryerror error is thrown:
List dataList; //contains arraylist of arraylists
record = null;
record = (ArrayList) dataList.get(i);
value = null;
cellValue = null;
theCell = null;
value = record.get(j);
cellValue = value.toString();
// Sets color scheme for every other row
theCell = new Label(colNo,rowNo,cellValue,formatRecord);
theCell = new Label(colNo,rowNo,cellValue);
Anyway that I can split up the processing to avoid the error? I don't have access to any command line arguments since this is a small portion of a much bigger jsp project. Therefore, changing the heap size is not an option. As far as I know, with a big enough resultset, altering the heap size would still not take care of the issue.
Any and all comments are welcome/needed!