From https://lists.apache.org/thread.html/b59a525b6a4dbea9de4d138952c0ab2629c528423f19b363d3434452@%3Cuser.poi.apache.org%3E Subject: Too much memory is used by a hyperlink in a spreadsheet Author: Dmitry Katsubo Memory consumption can be reduced by delaying when new CTHyperlink objects are created until writing the hyperlinks out to <hyperlinks> after <sheetData/> in <worksheet>.
Applied Dmitry's patch from email (with modification) in r1771231.
Update SXSSF how-to.html to mention that hyperlinks may use a lot of memory in r1771233.
The patch is just a minor drop into the sea… more fundamental solution is needed. As complete solution also involves other objects like comments and regions, perhaps the ultimate goal is difficult to achieve. However I think that hyperlinks are potentially used mostly. Javen, what kind of workarounds do you think are feasible at the moment?
*** Bug 60723 has been marked as a duplicate of this bug. ***
Simple code-sample from the duplicated bug: -example code: SXSSFWorkbook wb = new SXSSFWorkbook(100); SXSSFSheet sheet = wb.createSheet(); CreationHelper createHelper = wb.getCreationHelper(); Hyperlink link; SXSSFRow row; SXSSFCell cell; for(int i=0; i<1000000; i++){ row = sheet.createRow(i); cell = row.createCell(1); cell.setCellValue("Click Me"); link = createHelper.createHyperlink(Hyperlink.LINK_URL); link.setAddress("http://yoururl.com"); cell.setHyperlink(link); } //then code to write to file.