mardi 24 février 2015

Java Apache POI XSSFWorkbook free up ram

I am working with quite big excel files using Apache POI and I need to free up ram after I am done using a file. Currently after loading 'A' excel file java process takes 2 gb of ram, if I call close() method it will still take 2 gb of ram and if I load another 'B' excel file, windows will terminate java process due to lack of memory. The initial amount of ram taken by file 'A' is never freed up.



try {
XSSFWorkbook wb = new XSSFWorkbook(path);
sheetAmount = wb.getNumberOfSheets();

.. Do stuff

wb.close();
} catch(Exception ioe) {
ioe.printStackTrace();
}

Aucun commentaire:

Enregistrer un commentaire