Did some more research. It does not seem to be memory leakage as when I execute cell.getStringCellValue() for same cells again and again, memory used remains almost same after first call for given cell. Must be some caching of cell data inside workbook object.
Thanks Niraj From: <Nawanit>, "Nawanit, Niraj" <[email protected]<mailto:[email protected]>> Date: Wednesday, March 6, 2013 4:24 AM To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>> Subject: problem with possible memory leakage in my code 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
