Memory management while working with large data

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for Java (v7)  /  Memory management while working with large data

DynamicPDF Generator for Java (v7) Forum

Hi,

I am generating a PDF in which there is mostly table, now this table  data is very large (say about 80,000 - 1,00,000 rows), So i have some memory questions about it.

When is the memory released of the Table2 ? After I add the table in the page or after I draw the PDF. Please explain this in details.

I have been suggested a work around that i break this large table in small tables(say 1000 rows) and add it in page. Will this help memory wise or do you suggest some other way for working with this kind of large data.
Posted by a ceTe Software moderator
Hello,

The DynamicPDF API releases all the resources after drawing the PDF. Then the Garbage Collector will take care of clearing the unused objects. Since Our API builds the whole Document in memory you will need to make sure that you are having sufficient resources available in your system. Also please refer to the documentation on performance consideration here.

The Table2 object is released once the PDF is drawn using Draw method. You can either use multiple Table2 objects or a single Table2 object but please note that the memory used by our Document object will be dependent on the amount of contents you are adding.

Thanks,
ceTe Software Support Team.
Hi,

I refereed the documentation you suggested but still i have one question.

Say if I add the 1000 rows in a Table2 object and add it to a page and refill the Table2 object with next set of 1000 rows then my question, What about the memory that was hold up by the Table2 object for the first set 1000 rows? Will it be released for garbage collection ?
Posted by a ceTe Software moderator
Hello,

All the objects including Table2 will be released once the Document is drawn. The Table2 object will be held in memory for the first 1000 rows even after adding it to page and will not be released for garbage collection until the document is drawn.

Thanks,
ceTe Software Support Team.
Hi,

Thanks for the quick replies.

The suggestions are not working for us. So we are thinking of the using your merger part as well. We are thinking of using it as follows,

We generate a table of 1000 rows and draw the document. Thus according to your previous suggestion this memory would be released. And lastly merging all the documents into one using your MergeDocument class. Now my question is, What is the memory analysis of this MergeDocument class ? Can you give us some info or links explaining this class ?
I am guessing that this classes memory hold up would be the total of memory hold up by each document that is being merged and this memory is released when it is drawn, Am I right ?

Do you recommend this way of using DynamicPDF ?
Posted by a ceTe Software moderator
Hello,

Yes, you are correct in that the MergeDocument object would hold all the temporary PDF documents in memory while merging and they will be released after the Draw method is called. So you would need to make sure that you have sufficient resources available in your system to handle merging several documents.

Using Merger to merge the PDFs with 1000 records may increase the final PDF size in comparison with the PDF generated normally by adding all the records at the same time. When you generate the entire PDF with all records using the Document object, you can reuse the resources like fonts, images etc as described here. But when you generate several PDFs with 1000 records each and merge them the internal PDF resources will get duplicated increasing the size of the merged PDF. 

Thanks,
ceTe Software Support Team.



All times are US Eastern Standard time. The time now is 3:12 PM.