Page 1 of 1

Memory usage when generate large document

PostPosted: Thu Aug 01, 2013 1:24 pm
by yangmandy
Hi Jason,

Currenly i use data binding to generate document. While in the template i have almost hundard content control elements and more than ten repeat. (There are mainly tables in this 200+ pages generated doucment) Once i generate my word, it will take up 2.2G memory of my PC .Even task finished, the memory will not release.

Could you kindly support me to solve this problem or give me good suggestion?

Thank you inadvance!

Mandy

Re: Memory usage when generate large document

PostPosted: Thu Aug 01, 2013 7:24 pm
by jason
Tell us more about your environment please. Is this in an IDE, using some app server, or from the command line? When the "task has finished" is the Java virtual machine still running?

Re: Memory usage when generate large document

PostPosted: Thu Aug 01, 2013 7:41 pm
by yangmandy
I run my app in IDE and extract my data from another server(this server directly give XML that word binding needs).
VM arguments:-Xms512m -Xmx4096m -XX:MaxPermSize=4096m
And backend console executes "INFO org.docx4j.model.datastorage.BindingTraverserXSLT .xpathGenerateRuns"
Yep,When the "task has finished" , the Java virtual machine IS still running.

Re: Memory usage when generate large document

PostPosted: Thu Aug 01, 2013 9:18 pm
by jason
Which IDE is it?

When I run something in Eclipse, it starts a jvm (which you can see in Windows task manager), and when the program terminates, that jvm goes as well.

If the jvm has stopped, and you are still seeing memory in use, well, that's not docx4j's fault.

If docx4j is holding on to objects, well, that's something that needs to be looked at.

Re: Memory usage when generate large document

PostPosted: Tue Oct 08, 2013 8:56 pm
by PoojaGe
Hi Jason,

I am facing the same issue.
My document is around 400 pages with lot of tables and the document size is around 1 MB.
VM arguments:-Xms512m -Xmx1024m -XX:MaxPermSize=256m

1. when i try run the program and load the document using something like:
2. WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(file);
Due to above, when i see task manager my CPU utilization increases to 100% and also the physical memory usage spikes up
3. I then process the document and save and reassign wordMLPackage to null

The problem is the memory doesn't get released and now if i make four or more consecutive calls for the above functionality on the same server, it throws Out of Memory Exception even though i make second call only after first is completely processed and references are returned back

Please help

Re: Memory usage when generate large document

PostPosted: Tue Oct 08, 2013 9:34 pm
by jason
What is your environment?

Re: Memory usage when generate large document

PostPosted: Tue Oct 08, 2013 10:55 pm
by PoojaGe
we are using unix(Solaris) and weblogic server(10.3)

Re: Memory usage when generate large document

PostPosted: Wed Oct 09, 2013 10:20 am
by jason
What does running a profiler tell you?

Re: Memory usage when generate large document

PostPosted: Wed Oct 09, 2013 5:41 pm
by PoojaGe
Hi Jason,

Haven't run the profiler yet, but one thing is certain as soon as i remove the below line
WordprocessingMLPackage wordML = WordprocessingMLPackage.load(InputFile);

There are no issues at all with the memory, its getting released properly.
so looks like these objects are being held up and due to some reason even garbage collection seem to be working for this.

Thanks

Re: Memory usage when generate large document

PostPosted: Sun Oct 20, 2013 10:03 am
by jason