I'm using XML bindings with docx4j to generate word docx reports.
In some cases when the XML is big 2 MB ( 40000 lines ) the heap usage goes up 1-2 GB and it takes 50-60 minutes to generate report.
The slowest part is the binding: ( BindingHandler.applyBindings(templateWordPackage.getMainDocumentPart()); )
did a memory profiling:
The thread java.lang.Thread @ 0x79100a248 Thread-127 keeps local variables with total size 1,362,944,720 (84.19%) bytes.
The memory is accumulated in one instance ...