Bug 44434 - FO java Memory Error
Summary: FO java Memory Error
Status: CLOSED DUPLICATE of bug 1063
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: all
Hardware: Sun other
: P2 critical
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-15 13:59 UTC by Yoganathan Kaliyaperumal
Modified: 2012-04-30 00:20 UTC (History)
1 user (show)



Attachments
xmlandxsl (51.77 KB, application/x-zip-compressed)
2008-03-13 12:39 UTC, Yoganathan Kaliyaperumal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yoganathan Kaliyaperumal 2008-02-15 13:59:19 UTC
Hi,

  We have fop_bin_0_14_0.jar to convert the XML to PDF. I'm trying to convert 
the hugh XML file into PDF and i'm getting the following error.

Exception in thread "main" java.lang.OutOfMemoryError

This is the showstopper and business is complaining that they couldn't run the 
hugh PDF reports. Could someone tell me on how to resolve this issue.

Thanks,
Nathan
Comment 1 J.Pietschmann 2008-02-15 14:36:17 UTC
First: FOP 0.14 is ancient, you are advised to update to a more recent release,
even if though it probably causes much pain due to adapting to the standard.

Second: The hints here http://xmlgraphics.apache.org/fop/0.94/running.html#memory
also apply.

Third: if the problem persists for the latest FOP release and further fine
tuning, you'll need to provide more details about your task and your
environment, preferably including the FO file causing the memory overflow.
Comment 2 Yoganathan Kaliyaperumal 2008-03-10 07:06:31 UTC
I've increased the java heap size but still i'm getting memory error. I'm pasting the XML and fo file here. Please let me know what is the problem

XML file: There are three columns. Third column benchmark has multiple lines tagged within <LINE>

- <composite_data>
  <composite_id>TC104</composite_id> 
  <composite_name>Diversified Large Cap Core Composite (TC104)</composite_name> 
  <composite_status>A</composite_status> 
  <composite_strategy>The investment objective of this composite is to provide excess returns over the S&P 500 Index through active stock selection while maintaining portfolio risk characteristics similar to the market.</composite_strategy> 
- <benchmark>
  <LINE>From: 30/09/1990</LINE> 
  <LINE>Standard & Poor's 500 Index</LINE> 
  </benchmark>
  </composite_data>

FO file:

<fo:table>
        <fo:table-column column-width="6cm"/>
        <fo:table-column column-width="12cm"/>
        <fo:table-column column-width="10cm"/>
        <fo:table-body font-family="Times Roman" font-size="10pt" line-height="15pt" font-weight="normal">

           <xsl:for-each select="//composite_data[composite_status = 'A']">
           <xsl:sort select="composite_id" data-type="text"/>

           <fo:table-row>

           <fo:table-cell padding-top="3mm"><fo:block>
           <xsl:value-of select="composite_name"/>
           </fo:block></fo:table-cell>

           <fo:table-cell padding-top="3mm" padding-left="1cm"><fo:block>
           <xsl:value-of select="composite_strategy"/>
           </fo:block></fo:table-cell>
             
           <fo:table-cell padding-top="3mm" padding-left="1cm"><fo:block>
	   <xsl:for-each select="benchmark">                      
             <xsl:for-each select="LINE">
               <fo:block>
                <xsl:value-of select="."/>
               </fo:block>
              </xsl:for-each>
	   </xsl:for-each>
	   </fo:block>
	   </fo:table-cell>

           </fo:table-row>

           </xsl:for-each>
        </fo:table-body>
      </fo:table>

Basically fo:block for each LINE is giving memory issue. If i remove it, all the lines are wrapped together in 3rd column but i want in seperate lines. Is there any way that i can display multi-records in a table-cell.

Thanks,
Nathan
Comment 3 Andreas L. Delmelle 2008-03-10 11:22:37 UTC
(In reply to comment #2)

> I've increased the java heap size but still i'm getting memory error. I'm
> pasting the XML and fo file here. Please let me know what is the problem
<snip />
>            <fo:table-cell padding-top="3mm" padding-left="1cm">
>            <fo:block>
>            <xsl:for-each select="benchmark">                      
>              <xsl:for-each select="LINE">
>                <fo:block>
>                 <xsl:value-of select="."/>
>                </fo:block>
>               </xsl:for-each>
>            </xsl:for-each>

Try:
<fo:table-cell...>
<fo:block linefeed-treatment="preserve">
<xsl:for-each select="benchmark">                      
    <xsl:for-each select="LINE">
      <xsl:value-of select="."/>
      <xsl:text>&#x0A;</xsl:text>
    </xsl:for-each>
</xsl:for-each>


Please let us know if this alleviates the problem. I suspect so, but I'm not 100% certain.

Thanks!
Comment 4 Yoganathan Kaliyaperumal 2008-03-10 11:41:12 UTC
Your solution didn't give any memory error. Thank you so much. But all the records in 3rd column are wrapped in single line as follows:

column1       column2          column3
 comp1        comp1 strat      From: 30/09/1990 Standard & Poor's 500 Index

But i want the record to be displayed in multi-line as below.

column1       column2          column3
comp1          comp1 strat     From: 30/09/1990 
                               Standard & Poor's 500 Index

Can you suggest something which can display the records in multi-line.

Thanks,
Nathan



                             
Comment 5 Andreas L. Delmelle 2008-03-10 11:51:28 UTC
(In reply to comment #4)
> Your solution didn't give any memory error. Thank you so much. But all the
> records in 3rd column are wrapped in single line as follows:
> 
> column1       column2          column3
>  comp1        comp1 strat      From: 30/09/1990 Standard & Poor's 500 Index
> 
> But i want the record to be displayed in multi-line as below.
> 
> column1       column2          column3
> comp1          comp1 strat     From: 30/09/1990 
>                                Standard & Poor's 500 Index
> 
> Can you suggest something which can display the records in multi-line.

That's what the linefeed character (&#x0A;) is for. That should work, unless... Do you have a keep-together or keep-with-next/-previous specified on the rows or the table. In that case, you probably want to change this to an explicit keep-together.within-page, keep-with-previous.within-page. If the component 'within-page' is not explicitly used, then keep-together also means keep-together.within-line, which overrides preserved linefeeds.
Comment 6 Andreas L. Delmelle 2008-03-10 11:54:10 UTC
(In reply to comment #5)
> 
> That's what the linefeed character (&#x0A;) is for. That should work, unless...

Just noticed that I did not yet ask: which FOP version? linefeed-treatment=preserve does not work in FOP 0.20.5. In case you're still using that version, it's time to upgrade...

Comment 7 Yoganathan Kaliyaperumal 2008-03-10 11:56:10 UTC
I'm using FOP 0.14 version fo xalan commandline.
Comment 8 Yoganathan Kaliyaperumal 2008-03-13 11:27:23 UTC
Can anyone suggest me what do i need to do in order to print the multi-records in seperate lines within a table-cell?

Thanks,
Nathan
Comment 9 Yoganathan Kaliyaperumal 2008-03-13 12:39:07 UTC
Created attachment 21664 [details]
xmlandxsl

I've attached the zip file. Please review it and let me know.
Comment 10 Andreas L. Delmelle 2008-03-14 11:26:16 UTC
FWIW: Nathan just confirmed to me off-list that a slightly tweaked version of the original stylesheet, using preserved linefeeds instead of nested blocks, renders fine with FOP 0.94 and does not cause memory issues with default heap settings.
Comment 11 Glenn Adams 2012-04-04 22:13:17 UTC

*** This bug has been marked as a duplicate of bug 1063 ***
Comment 12 Glenn Adams 2012-04-30 00:20:42 UTC
batch transition resolved+duplicate to closed+duplicate