HI we are using Aspose words- 7.0.0 to write a document and save it in PDF file.
The code structure of how we are writing is in the below mentioned format.
Document doc = null;
Document newDoc = new Document();
for(int i =0; i<size ; i++){
doc = new Document(templateFile);
// Code to add data in tables of document //
Table headingTable = (Table) doc.getChild(NodeType.TABLE, 0, true);
headingTable.getRows().get(3).getCells().get(3).getFirstParagraph().appendChild(new Run(doc, value));
Table doaTable = (Table) doc.getChild(NodeType.TABLE, 1, true);
doaTable.getRows().get(2).getCells().get(1).getFirstParagraph()
.appendChild(new Run(doc, value));
// Code to add data in tables of document //
newDoc.appendDocument(doc,ImportFormatMode.USE_DESTINATION_STYLES);
}
Node node = newDoc.getFirstSection();
node.remove();
ByteArrayOutputStream ms = new ByteArrayOutputStream();
newDoc.save(ms, SaveFormat.PDF);
byte[] extractedDocument = ms.toByteArray();
when we encountered out of memory error we analyzed heap dump and found that large data is held on objects of section under object document.
But it contains a tree structure of section Objects consisting large heap size.
like - com.aspose.words.Document
com.aspose.words.section
com.aspose.words.section …so on
Please find the attachement - aspose MAT analysis
Can you please let us know is this structure expected or is it something wrong from the way we implemented the API.