GC overhead limit exceeded with Apache POI

前端 未结 4 1589
粉色の甜心
粉色の甜心 2020-12-16 17:46

I have 13 .xlsx files with about 1000 rows in each of them. Now I want to merge it to one .xlsx file with one sheet. I\'m using code from here http://blog.sodhanalibrary.com

4条回答
  •  隐瞒了意图╮
    2020-12-16 18:17

    POI is notoriously memory-hungry, so running out of memory is not uncommon when handling large Excel-files.

    When you are able to load all original files and only get trouble writing the merged file you could try using an SXSSFWorkbook instead of an XSSFWorkbook and do regular flushes after adding a certain amount of content (see poi-documentation of the org.apache.poi.xssf.streaming-package). This way you will not have to keep the whole generated file in memory but only small portions.

提交回复
热议问题