Bug 63657

Summary: Memory usage increase during writing Documents introduced in 4.0.0
Product: POI Reporter: Dominik Stadler <dominik.stadler>
Component: XSSFAssignee: POI Developers List <dev>
Severity: regression    
Priority: P2    
Version: 4.0.0-FINAL   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Bug Depends on: 62130    
Bug Blocks:    

Description Dominik Stadler 2019-08-11 08:28:51 UTC
The changes for bug #62130 introduced a large memory increase due to the way Apache XMLBeans handles references to the CTCellImpl objects in XSSFRow/CTRowImpl and XSSFCell.

During writing a document, all CTCellImpl objects are now copied, while the CTRowImpl in XSSFRow still keeps a reference to the previous object, thus causing double memory usage until the XSSFWorkbook is removed from memory.
Comment 1 Dominik Stadler 2019-08-12 18:43:23 UTC
Fixed via r1864977, XMLBeans is quite hard to handle here, setCArray() does not set the passed objects, but rather populates existing ones if possible, so the code in XSSFRow.onDocumentWrite() actually duplicated all CTCellImpl objects and kept both until the XSSFWorkbook was freed up.