Hi List.
I am using the newest version of the poi-lib to read values from an excel
sheet. So now, everytime when i call the method to read data from the excel
sheet, it incrases the memory usage of my application (sometimes + 1 MB,
otherwise + 500 kb).
If i let it run the whole night, i sure will have a "Memory Out Of Bounds
Exception".
I looked with a profile on my code and it seems to be a problem with the
poi-lib.
This is my code to read data.
As you can see, I added this:
wb.removeSheetAt(0);
wb = null;
sheet = null;
cell = null;
System.runFinalization();
and hoped that it was a problem by not removing any objects, but it seams to be
anothe one??
Thank you all..
HSSFWorkbook wb; //For representing an excel file
HSSFSheet sheet; //An excel file may have many sheets(tabs)inside
HSSFCell cell; // A constituent of a row
InputStream is;
private void loadLanguages(){
if(list.size()!=0)
list.removeAllElements();
try {
is = new FileInputStream(f.getAbsolutePath()+ "\\languages\\" +
McConfig.actLanguage +".xls");
wb = new HSSFWorkbook(new POIFSFileSystem(is));
sheet = wb.getSheetAt(0); //First sheet of the excel file
for(int i=0;i<sheet.getLastRowNum()+1;i++){
list.add(sheet.getRow(i).getCell((short)0).getStringCellValue());
}
McIoTranslator.list = McIoLoadLanguage.getTranslatedList();
McIoTranslator.fill();
isGeladen = true;
wb.removeSheetAt(0);
wb = null;
sheet = null;
cell = null;
System.runFinalization();
is.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/