Page 1 of 1

Alternative solution to the out of memory problem?

PostPosted: Thu Jun 16, 2011 11:15 pm
by ShinoKarun
Hi
I am trying to convert a docx file to a pdf but I keep getting the out of memory problem; which i believe is due to the font mapping process. I have increased the PermGen to fix the problem but i want to know if there is another solution.

Thanks
ShinKarun

Re: Alternative solution to the out of memory problem?

PostPosted: Thu Jun 16, 2011 11:47 pm
by jason
Hi, yes the solution is to implement your own font mapper. You could either specify a restricted subset of fonts by inclusion, or by excluding the large ones.
Of course, if its a font you need which is causing the memory issue, this won't help.

Re: Alternative solution to the out of memory problem?

PostPosted: Tue Jun 21, 2011 4:56 am
by ShinoKarun
Thanks for the Reply Jason

I created an empty mapper class with just the populateFontMappings without adding any fonts just to see if this would fix the problem, but when I ran the program again i got the PermGen space problem. Could there be something else which could be causing this? Also if you have a solution I would really appreciate it.


Thanks Again
ShinoKarun

Re: Alternative solution to the out of memory problem?

PostPosted: Tue Jun 21, 2011 9:48 am
by jason
How long is your docx? Anything special about it (eg lots of tables, images, or embedded documents)?

What did you increase permgen to? Are you sure it worked (are you doing this in an IDE or what?)?

You can take docx4j out of the equation, by turning DEBUG level logging on on the PDF conversion, which causes the intermediate XSL-FO to be saved. You can then run this through FOP without using docx4j at all, to see whether you still have a memory issue.

Re: Alternative solution to the out of memory problem?

PostPosted: Tue Jun 21, 2011 8:24 pm
by ShinoKarun
jason wrote:How long is your docx? Anything special about it (eg lots of tables, images, or embedded documents)?


I have many different docx files with varying lengths. Most of them have tables, borders, pictures and some complex layout.

jason wrote:What did you increase permgen to? Are you sure it worked (are you doing this in an IDE or what?)?


I'm running docx4j on a JBoss server setting the permgen size in eclipse. When i increase the permgen space to your suggested '-XX:PermSize=256m -XX:MaxPermSize=512' from other threads, it works fine. Only when I don't specify the space that I get the out of Memory error.

Thanks
ShinoKarun





When