Hi all,

I have written a below small code:


XSSFWorkbook workbook = new XSSFWorkbook("/Users/nawanit/Desktop/test.xlsx");

XSSFSheet sh = workbook.getSheet("Sheet1");

for (int i=0; i < sh.getLastRowNum(); i++) {

XSSFRow row = sh.getRow(i);

if (row == null) continue;

for (int j=0; j < row.getLastCellNum(); j++) {

XSSFCell cell = row.getCell(j);

if (cell != null) {

String s = cell.getStringCellValue();

}

}

}


The XLSX file is of say 2000 rows and 150 columns and contains string type 
cells only. I am observing that 'String s = cell.getStringCellValue();' is 
causing heap memory to increase for each call even when I store its return 
value in a local scope variable. In total, workbook took around 381 MB of heap 
and the FOR loops caused extra 90 MB of heap to be used.


Is this a known issue? I am using Apache POI 3.7 in my project. Should it be 
treated as a possible memory leak problem?


Thanks

Niraj

Reply via email to