You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Kr...@aps.com on 2007/02/14 19:37:21 UTC

Exception in thread "main" java.lang.OutOfMemoryError

Hello All,

I am trying to convert an XML document(approx about 110 pages long,
777KB) into a pdf document using an FO transformation. But it gives me
the following error.

Exception in thread "main" java.lang.OutOfMemoryError

I tried the last three solutions mentioned here.
<http://xmlgraphics.apache.org/fop/0.93/running.html>

But I donot know how to increase the heap size available to the JVM.Can
anybody let me know how to do it so I can try that last option too.
Thanks,
Sindhu 



Email Firewall made the following annotations
------------------------------------------------------------------------ NOTICE ---

This message is for the designated recipient only and may contain confidential, privileged or proprietary information. If you have received it in error, please notify the sender immediately and delete the original and any copy or printout. Unintended recipients are prohibited from making any other use of this e-mail. Although we have taken reasonable precautions to ensure no viruses are present in this e-mail, we accept no liability for any loss or damage arising from the use of this e-mail or attachments, or for any delay or errors or omissions in the contents which result from e-mail transmission.

---------------------------------------------------------------------

Re: Exception in thread "main" java.lang.OutOfMemoryError

Posted by Mathieu Malaterre <ma...@gmail.com>.
On debian fop is using: JAVA_OPTS. I have seen also FOP_OPTS being used.
Anyway the fop command is usally simply a wrapper around the java
command, so you could just open that file and change what ENV var they
are using for passing option to the java command.

HTH
-M
Ref:
http://gdcm.sourceforge.net/wiki/index.php/Module_Attributes#How_To

On 2/14/07, Krishna.Cherla@aps.com <Kr...@aps.com> wrote:
>
>
>
> Hello All,
>
> I am trying to convert an XML document(approx about 110 pages long,
> 777KB) into a pdf document using an FO transformation. But it gives me
> the following error.
>
> Exception in thread "main" java.lang.OutOfMemoryError
>
> I tried the last three solutions mentioned here.
> <http://xmlgraphics.apache.org/fop/0.93/running.html>
>
> But I donot know how to increase the heap size available to the JVM.Can
> anybody let me know how to do it so I can try that last option too.
>
> Thanks,
> Sindhu
>
>
> Email Firewall made the following annotations
> ---------------------------------------------------------------------
> --- NOTICE ---
> This message is for the designated recipient only and may contain
> confidential, privileged or proprietary information. If you have received it
> in error, please notify the sender immediately and delete the original and
> any copy or printout. Unintended recipients are prohibited from making any
> other use of this e-mail. Although we have taken reasonable precautions to
> ensure no viruses are present in this e-mail, we accept no liability for any
> loss or damage arising from the use of this e-mail or attachments, or for
> any delay or errors or omissions in the contents which result from e-mail
> transmission.
> ---------------------------------------------------------------------
>


-- 
Mathieu

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


AW: [SPAM] Re: Exception in thread "main" java.lang.OutOfMemory Error

Posted by Hinrich Aue <hi...@lci-software.com>.
You can also use different xslt processors.
I'm using xsltproc.
Question - what is better. FOP or xsltproc? (for xsl processing of course)

-----Ursprüngliche Nachricht-----
Von: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Gesendet: Freitag, 16. Februar 2007 16:31
An: fop-users@xmlgraphics.apache.org
Betreff: [SPAM] Re: Exception in thread "main" java.lang.OutOfMemory Error

Instead of:
fop -xsl test.xsl -xml test.xml -pdf test.pdf

you do:
fop -xsl test.xsl -xml test.xml -foout test.fo
and then
fop -fo test.fo -pdf test.pdf


On 16.02.2007 16:22:06 Krishna.Cherla wrote:
> 
> Hello,
> 
> I tried the process again after I upgraded the FOP version to 0.93. But
> it still gives me the same error though i increase the memory. 
> How do I seperate the XSLT process from the FO formatting ?Thanks for
> all the help being rendered.
> 
> Sindhu


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Exception in thread "main" java.lang.OutOfMemory Error

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Instead of:
fop -xsl test.xsl -xml test.xml -pdf test.pdf

you do:
fop -xsl test.xsl -xml test.xml -foout test.fo
and then
fop -fo test.fo -pdf test.pdf


On 16.02.2007 16:22:06 Krishna.Cherla wrote:
> 
> Hello,
> 
> I tried the process again after I upgraded the FOP version to 0.93. But
> it still gives me the same error though i increase the memory. 
> How do I seperate the XSLT process from the FO formatting ?Thanks for
> all the help being rendered.
> 
> Sindhu


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


AW: [SPAM] Re: Exception in thread "main" java.lang.OutOfMemory Error

Posted by Hinrich Aue <hi...@lci-software.com>.
I had the same problem using fop 0.20.5.
Memory usage seems to have reduced a lot in FOP 0.93.
Maybe that's it?

Hinrich

-----Ursprüngliche Nachricht-----
Von: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
Gesendet: Freitag, 16. Februar 2007 10:39
An: fop-users@xmlgraphics.apache.org
Betreff: [SPAM] Re: Exception in thread "main" java.lang.OutOfMemory Error

Given what you told us it's unlikely that you can make it work without
more memory in your computer. Maybe, if we had access to your XML and
stylesheet, one of us might have another suggestion. It would also be
good for us to have a really large document like yours that we can do
tests with.

Anyway, I'd try to simplify the stylesheet as much as you can, doing as
much as you can with property inheritance. Remove any attribute that is
not absolutely necessary. Don't nest elements where it's not absolutely
necessary. Remove page numbering just as a test to see if it changes
anything. Separate the XSLT process from the FO formatting so these two
don't run at the same time. XSLT alone may use up quite a bit of memory.

Please give us feedback even if you manage to make it run. Thanks.

On 15.02.2007 22:25:08 Krishna.Cherla wrote:
> Hello All,
> 
> As i have discussed in the previous threads I get an  Exception in
> thread "main" java.lang.OutOfMemory Error when I try to pdf xml
> documents.
> 
> *	I tried increasing the memory available to the JVM (used this
> command line option:
> 	C:\Program Files\Altova\FOP\build>java -Xmx512m -jar fop.jar fop
> -xsl test.xsl -xml test.xml -pdf test.pdf ). This helped me convert a
> 777KB Xml document into a PDF Document(about 100 pages). But when I try
> converting an 4500KB Xml Document(approx. about 400 pages long) it gives
> me an out of memory error again.I can't increase the memory more than
> that as my physical RAM is only 523 MB.
> *	I donot have any figures in the document.
> *	I do use a page numbering scheme that includes a total number of
> pages in the document that makes use of forward referencingand I cannot
> bypass this. 
> *	I have three page sequences but I'm afraid can't break the
> document into any more. And each sequence does contain a lot of fo
> elements.
> 
> Can anybody guide me more  in regards to this?
> 
> Sindhu
> 


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Exception in thread "main" java.lang.OutOfMemory Error

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Given what you told us it's unlikely that you can make it work without
more memory in your computer. Maybe, if we had access to your XML and
stylesheet, one of us might have another suggestion. It would also be
good for us to have a really large document like yours that we can do
tests with.

Anyway, I'd try to simplify the stylesheet as much as you can, doing as
much as you can with property inheritance. Remove any attribute that is
not absolutely necessary. Don't nest elements where it's not absolutely
necessary. Remove page numbering just as a test to see if it changes
anything. Separate the XSLT process from the FO formatting so these two
don't run at the same time. XSLT alone may use up quite a bit of memory.

Please give us feedback even if you manage to make it run. Thanks.

On 15.02.2007 22:25:08 Krishna.Cherla wrote:
> Hello All,
> 
> As i have discussed in the previous threads I get an  Exception in
> thread "main" java.lang.OutOfMemory Error when I try to pdf xml
> documents.
> 
> *	I tried increasing the memory available to the JVM (used this
> command line option:
> 	C:\Program Files\Altova\FOP\build>java -Xmx512m -jar fop.jar fop
> -xsl test.xsl -xml test.xml -pdf test.pdf ). This helped me convert a
> 777KB Xml document into a PDF Document(about 100 pages). But when I try
> converting an 4500KB Xml Document(approx. about 400 pages long) it gives
> me an out of memory error again.I can't increase the memory more than
> that as my physical RAM is only 523 MB.
> *	I donot have any figures in the document.
> *	I do use a page numbering scheme that includes a total number of
> pages in the document that makes use of forward referencingand I cannot
> bypass this. 
> *	I have three page sequences but I'm afraid can't break the
> document into any more. And each sequence does contain a lot of fo
> elements.
> 
> Can anybody guide me more  in regards to this?
> 
> Sindhu
> 


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fwd from fop-users@: OutOfMemoryError

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Mar 1, 2007, at 11:00, Andreas L Delmelle wrote:

> <snip />
> It seems that our text-layout-algorithm works perfectly well on  
> small to medium-sized blocks, but there is a slight problem with  
> the scalability.

Some further follow-up:
Traced it down to the main loop in  
BreakingAlgorithm.findBreakingPoints() (line 456).
If I debug the process, and place the breakpoint at finish() right  
after the main loop, the OOMError happens somewhere before that.

The base Paragraph's size is roughly 81000 elements (for roughly 125K  
characters), and with a heap of 512MB, the loop does not make it to  
index 71000. activeLines grows to 5120 elements.

OTOH, to relieve the fears a bit:
Simply changing the FO to use linefeed-treatment="preserve", which is  
a lot more common in case you have large preformatted text-blocks,  
already helps a great deal. Switching to linefeed-preservation alone  
makes the example pass with default heap settings.

Case closed FTM.

Cheers,

Andreas



Re: Fwd from fop-users@: OutOfMemoryError

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Feb 28, 2007, at 23:38, Andreas L Delmelle wrote:

> <snip />
> So, I also tried manually inserting fo:blocks around each scene in  
> the example, but then bumped into an Exception:

That Exception seems to be related to the "last_even" page-master.  
Comment that out, and the alternate version of the test succeeds.

So, it isn't even necessary to split up in multiple page-sequences.  
Multiple blocks is enough.

It seems that our text-layout-algorithm works perfectly well on small  
to medium-sized blocks, but there is a slight problem with the  
scalability.


Cheers,

Andreas

Fwd from fop-users@: OutOfMemoryError

Posted by Andreas L Delmelle <a_...@pandora.be>.
Begin forwarded message:

Hi people,

> From: Jeremias Maerki <de...@jeremias-maerki.ch>
>
> Interesting: a simple FO wrapper around a big preformatted text file.
> <snip />
> Still, it's a little scary when 0.20.5 processes this file in one  
> second
> while 0.93 allocates 500MB+ memory for a 250KB file and eventually  
> dies
> the OutOfMemory death. It's a very special example you have here.

Note that, even when you trim it down to only the first page- 
sequence, 512MB of heap is not enough for 0.93/Trunk

Since I was a bit intrigued by this example, I did a quick debug  
session to try to establish the location of the drain.
Started off by placing a sole breakpoint in  
PageSequenceLayoutManager.activateLayout(), and it seems 0.93 has no  
problem constructing the FO tree... as I expected, since the  
structure is very simple.
There are four FOText instances per page-sequence, as the text-blocks  
get split up into chunks of Short.MAX_VALUE characters at most (~ (3  
x 32K) + 29K). The reason being that the TextLM uses shorts as  
indices for the AreaInfos, and thus can't handle larger text-blocks.

This corresponds to four Paragraphs in the LineLayoutManager. The  
initial element list construction for the Paragraphs isn't a problem  
either. It is only when going further, createLineBreaks()- 
 >findOptimalBreakingPoints(), that the trouble starts...

In this case, it seems to be a logical consequence of the total-fit  
line-breaking algorithm. Peculiar example because here total-fit on  
block-level means the same as total-fit on page-sequence-level.

So, I also tried manually inserting fo:blocks around each scene in  
the example, but then bumped into an Exception:

Feb 28, 2007 11:33:55 PM  
org.apache.fop.fo.pagination.PageSequenceMaster getNextSimplePageMaster
WARNING: subsequences exhausted in page-sequence-master 'chapter',  
using previous subsequence
Feb 28, 2007 11:33:55 PM org.apache.fop.cli.Main startFOP
SEVERE: Exception
java.lang.IllegalStateException: subsequences exhausted in page- 
sequence-master 'chapter', cannot recover
         at org.apache.fop.cli.InputHandler.transformTo 
(InputHandler.java:168)
         at org.apache.fop.cli.InputHandler.renderTo 
(InputHandler.java:115)
         at org.apache.fop.cli.Main.startFOP(Main.java:166)
         at org.apache.fop.cli.Main.main(Main.java:197)

The investigation continues...


Cheers,

Andreas


Re: [SPAM] Exception in thread "main" java.lang.OutOfMemoryError

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Feb 28, 2007, at 19:53, Tyndyll wrote:

Hi Tyndyll,

>
> I've often been told that I'm special :)
>
> I dumped the data in because the example called for a lump of data to
> generate 35 pages. I'd prefer to use 0.93 so its time to adapt to  
> survive :)

Just FYI: I did a little follow-up on this on fop-dev@, and it seems  
to be a problem with scalability of the text-layout-algorithm. In  
your case, putting each of the scene-blocks in your example in its  
own fo:block already avoids the error.

Note that I did alter the FO to use linefeed-treatment="preserve".

The result looks as good as can be expected.


Cheers,

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: [SPAM] Exception in thread "main" java.lang.OutOfMemoryError

Posted by Tyndyll <se...@hotmail.com>.
I've often been told that I'm special :)

I dumped the data in because the example called for a lump of data to
generate 35 pages. I'd prefer to use 0.93 so its time to adapt to survive :)

For the reference of anyone looking at this at a later date (including me
see 
http://xmlgraphics.apache.org/fop/dev/design/index.html#pri-goal-unlimited-size
the design spec )



Jeremias Maerki-2 wrote:
> 
> Interesting: a simple FO wrapper around a big preformatted text file.
> Run it through FOP 0.20.5. That should work but you won't be happy with
> the result unless you change a few things in the FO file (the
> white-space-collapse="false" hack for 0.20.5 to begin with). 0.93 simply
> cannot handle documents like this, yet. We've got ideas but that'll take
> time. In the meantime, try to convert the content into markup (as it
> should be) and split it up into page-sequences. XSL-FO cannot
> automagically format the preformatted ASCII file into something nice.
> 
> Still, it's a little scary when 0.20.5 processes this file in one second
> while 0.93 allocates 500MB+ memory for a 250KB file and eventually dies
> the OutOfMemory death. It's a very special example you have here.
>  
-- 
View this message in context: http://www.nabble.com/Exception-in-thread-%22main%22-java.lang.OutOfMemoryError-tf3229008.html#a9226379
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: [SPAM] Exception in thread "main" java.lang.OutOfMemoryError

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Interesting: a simple FO wrapper around a big preformatted text file.
Run it through FOP 0.20.5. That should work but you won't be happy with
the result unless you change a few things in the FO file (the
white-space-collapse="false" hack for 0.20.5 to begin with). 0.93 simply
cannot handle documents like this, yet. We've got ideas but that'll take
time. In the meantime, try to convert the content into markup (as it
should be) and split it up into page-sequences. XSL-FO cannot
automagically format the preformatted ASCII file into something nice.

Still, it's a little scary when 0.20.5 processes this file in one second
while 0.93 allocates 500MB+ memory for a 250KB file and eventually dies
the OutOfMemory death. It's a very special example you have here.

On 27.02.2007 12:56:49 Tyndyll wrote:
> 
> Hi Lou,
> 
> I'm using Sun Java 1.6 and trying to produce a PDF from a much smaller file
> (253kB). I too am getting the Out Of Memory error, but only while using Fop
> 0.93. This is after adding the -Xmx512m switch to the batch file. Performing
> the same process using 0.20.5 results in the output PDF produced in
> seconds...
> 
> I am trying to recreate an example from the XSL-FO O'Reilly book to
> demonstrate Complex Page Sequences. I only have one page-sequence containing
> data to be converted. I've included the FO file here 
> http://www.nabble.com/file/6814/complex.fo complex.fo . 
> 
> Any advice on other things to try, or how to update this code to something
> 0.93 would prefer would be much appreciated
> 
> Thanks
> 
> Tyndyll
> 
> 
> Louis.Masters wrote:
> > 
> > For Sun's java, on the java command line, use something like this:
> > 
> > -Xmx512m
> > 
> > The 512m means 512 megabytes of memory.  Set it to whatever you need. 
> > Check out your java compiler/exe vendor for more details.
> > 
> > -Lou
> > 
> > 
> -- 
> View this message in context: http://www.nabble.com/Exception-in-thread-%22main%22-java.lang.OutOfMemoryError-tf3229008.html#a9180498
> Sent from the FOP - Users mailing list archive at Nabble.com.



Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: [SPAM] Exception in thread "main" java.lang.OutOfMemoryError

Posted by Tyndyll <se...@hotmail.com>.
Hi Lou,

I'm using Sun Java 1.6 and trying to produce a PDF from a much smaller file
(253kB). I too am getting the Out Of Memory error, but only while using Fop
0.93. This is after adding the -Xmx512m switch to the batch file. Performing
the same process using 0.20.5 results in the output PDF produced in
seconds...

I am trying to recreate an example from the XSL-FO O'Reilly book to
demonstrate Complex Page Sequences. I only have one page-sequence containing
data to be converted. I've included the FO file here 
http://www.nabble.com/file/6814/complex.fo complex.fo . 

Any advice on other things to try, or how to update this code to something
0.93 would prefer would be much appreciated

Thanks

Tyndyll


Louis.Masters wrote:
> 
> For Sun's java, on the java command line, use something like this:
> 
> -Xmx512m
> 
> The 512m means 512 megabytes of memory.  Set it to whatever you need. 
> Check out your java compiler/exe vendor for more details.
> 
> -Lou
> 
> 
-- 
View this message in context: http://www.nabble.com/Exception-in-thread-%22main%22-java.lang.OutOfMemoryError-tf3229008.html#a9180498
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Exception in thread "main" java.lang.OutOfMemoryError

Posted by Lo...@log-net.com.
For Sun's java, on the java command line, use something like this:

-Xmx512m

The 512m means 512 megabytes of memory.  Set it to whatever you need. 
Check out your java compiler/exe vendor for more details.

-Lou



Krishna.Cherla@aps.com wrote on 02/14/2007 01:37:21 PM:

> Hello All, 
> I am trying to convert an XML document(approx about 110 pages long, 
> 777KB) into a pdf document using an FO transformation. But it gives me 
> the following error. 
> Exception in thread "main" java.lang.OutOfMemoryError 
> I tried the last three solutions mentioned here. <http:
> //xmlgraphics.apache.org/fop/0.93/running.html> 
> But I donot know how to increase the heap size available to the JVM.
> Can anybody let me know how to do it so I can try that last option too.
> Thanks, 
> Sindhu 
> 
> Email Firewall made the following annotations 
> ------------------------------------------------------------------------
> NOTICE --- 
> This message is for the designated recipient only and may contain 
> confidential, privileged or proprietary information. If you have 
> received it in error, please notify the sender immediately and 
> delete the original and any copy or printout. Unintended recipients 
> are prohibited from making any other use of this e-mail. Although we
> have taken reasonable precautions to ensure no viruses are present 
> in this e-mail, we accept no liability for any loss or damage 
> arising from the use of this e-mail or attachments, or for any delay
> or errors or omissions in the contents which result from e-mail 
transmission. 
> ---------------------------------------------------------------------