https://issues.apache.org/bugzilla/show_bug.cgi?id=52204
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX --- Comment #3 from Yegor Kozlov <[email protected]> 2011-11-18 12:50:09 UTC --- It is not a bug, rather a feature of the XSSF API. In short, .xlsx file is a zip archive and there are two ways to open it: 1) from file which leads to invoking java.util.zip.ZipFile(File file) deep in POI internals. 2) from input stream in which case we first read everything into memory and then pass the data to ZipInputStream It should be noted, that (2) uses quite a bit more memory than (1), which doesn't need to hold the whole zip file in memory, and can take advantage of native methods. As you may guessed, (1) opens the underlying zip but does not close it which results in a leak. You have two choices: choice 1: open from FileInputStream choice 2: re-write your code as follows: OPCPackage pkg = OPCPackage.open(file); XSSFWorkbook wb = new XSSFWorkbook(pkg); // work with workbook pkg.close(); // gracefully closes the underlying zip file I'm going to update the documentation to reflect this feature. Regards, Yegor -- Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
