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 Tyndyll <se...@hotmail.com> on 2007/02/27 12:56:49 UTC

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

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: 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