xmlgraphics-fop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manuel Mall ...@arcus.com.au>
Subject Re: FOP Memory issues (fwd from fop-users)
Date Tue, 09 Jan 2007 13:11:24 GMT
On Tuesday 09 January 2007 18:13, richardw@geoquip-rnd.demon.co.uk 
wrote:
> Andreas L Delmelle writes:
>  > If I remember correctly, that was precisely the problem, since
>  > Cliff's report consists of one giant table. It's supposed to look
>  > like one uninterrupted flow, so figuring out where the
>  > page-sequences should end is next to impossible... (or IOW:
>  > sorting that out kind of defeats the purpose of using a formatter
>  > to compute the page-breaks) :/
>
> That's exactly the same problem I ran up against. Hence my
> investigations into properties and memory consumption. On my current
> setup (as per the last patch under 41044) and using my current 16MB
> fo file, the object counts are as follows:
>
> 349576 instances of class
> org.apache.fop.fo.properties.CondLengthProperty 145647 instances of
> class org.apache.fop.fo.properties.KeepProperty 126237 instances of
> class org.xml.sax.helpers.LocatorImpl
> 116521 instances of class org.apache.fop.fo.properties.SpaceProperty
> 87814 instances of class java.lang.Object[]
> 87458 instances of class java.util.ArrayList
> 87394 instances of class
> org.apache.fop.fo.properties.CommonBorderPaddingBackground 87394
> instances of class
> org.apache.fop.fo.properties.CommonBorderPaddingBackground$BorderInfo
>[] 87394 instances of class
> org.apache.fop.fo.properties.CondLengthProperty[] 81632 instances of
> class char[]
> 48548 instances of class
> org.apache.fop.fo.properties.LengthRangeProperty 42649 instances of
> class java.lang.String
> 38841 instances of class
> org.apache.fop.fo.properties.CommonMarginBlock 38839 instances of
> class org.apache.fop.datatypes.LengthBase 38839 instances of class
> org.apache.fop.fo.properties.PercentLength 38838 instances of class
> org.apache.fop.fo.flow.Block
> 38836 instances of class org.apache.fop.fo.flow.TableCell
> 9710 instances of class org.apache.fop.fo.flow.TableRow
> 5021 instances of class java.lang.Integer
> 4329 instances of class java.util.HashMap$Entry
> 1521 instances of class java.lang.Class
> 787 instances of class java.awt.Color
> 667 instances of class java.util.HashMap$Entry[]
> 658 instances of class java.util.HashMap
> 330 instances of class java.util.Hashtable$Entry
> 201 instances of class java.util.WeakHashMap$Entry
> 181 instances of class org.apache.fop.fo.properties.EnumProperty
> 160 instances of class
> java.util.concurrent.ConcurrentHashMap$HashEntry[] 160 instances of
> class java.util.concurrent.ConcurrentHashMap$Segment 160 instances of
> class java.util.concurrent.locks.ReentrantLock$NonfairSync 127
> instances of class java.lang.String[]
> 116 instances of class java.util.LinkedHashMap$Entry
> 110 instances of class byte[]
> ...
>

Richard,

very good stuff. I am trying to make sense of the numbers. Let me 
paraphrase the data:

A table with 4 columns and 9710 rows. Each table cell contains a block 
and there is also a block around the table. This gives us (roughly) the 
87394 CommonBorderPaddingBackground and CondLengthProperty[] instances. 
We also have an ArrayList (the property list) per formatting object and 
each ArrayList is backed by an Object[].

What are the 81632 instances of class char[]? I assume this is the text 
in the table cells. But why are there more than twice as many as there 
are table cells?

Your summary also shows 126237 instances of class 
org.xml.sax.helpers.LocatorImpl. I believe the only purpose of these 
helpers if for providing location information in error messages. Looks 
like a fairly expensive feature.

> As you can see, there's still a lot of value in getting the compound
> properties reusable - which I still intend on doing. This won't make
> it possible to handle arbitary documents, but will at least raise the
> bar somewhat.
>

Based on your above figures reusing identical compound property 
instances would certainly be a very useful improvement. A possible next 
step would be to reuse identical property lists. Especially in 
documents with lots of identically formatted table cells this would 
further reduce the memory footprint.

> I'm also currently reading through Knuth's Digital Typography. Can
> anyone point out any sections I should pay particular attention to
> w.r.t. FOP's usage,
>
> Regards,
>
> Richard

Manuel

Mime
View raw message