-When writing a million rows to excel, with each row having a hyper link, it causes java to run out of memory. Heap space set to 4GB. write to excel without hyper links ram usage was 160MB, with hyper links it used 4GB and crashed. -Because a hyperlink object needs to be recreate every time in order for it to work, it ends up eating ram. There doesn't seem to be a way to close hyperlink objects after they are used. -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.
We are already discussing this in bug 60416, I will add your code-example there to keep the discussion in one place. *** This bug has been marked as a duplicate of bug 60416 ***