Hi Archie,
Archie Cobbs wrote:
> I have an SVG file containing a <g> (defined in the <defs> section)
> which draws a room. This <g> contains about 115 <line> tags and
> one <polyline> tag.
>
> Then I render this <g> 288 times using <use> tags.
>
> When I try to display this in Batik, it runs out of memory.
Just in case you weren't aware I'll mention the
-Xmx flag that allows you to increase the amount of memory
available to Batik.
> After some playing around with it, it appears that each <line> tag
> I comment out results in about 853K more available memory. That is,
> since the image is drawn 288 times, each rendered <line> costs about
> 3034 bytes.
>
> Does 3K of memory usage for each <use>'d <line> seem right?
> That seems kind of high to me.
It's perhaps a bit higher than I would have expected but only
by a factor of 2 or so which probably means it's right ;). Just to
summarize the objects involved with each element in the DOM:
The Dom element it's self
A HashTable for it's attributes
An array for holding entries
For each attribute there is an Entry object
A String for the AttrName+NS and another for the value
The CSS properties for the Element
There are ~40 properties for each element (stored in
an array), there is a fair bit of sharing of
property values (perhaps there is room for improvement
here).
Event handlers (if needed)
The Bridge Element (for dynamic docs)
This is usually pretty small, just references to the
DOM Element and the GVT Node and the Bridge Context
(some elements cache more info here)
The GVT Graphics Node
This has several 'copies' of the geometry (unstroked,
stroked, markers).
Several Bounding Boxes (needed by SVG, some for
rendering, some for Object Bounding Box Coords, some
for pointer sensitivity).
Some Event stuff.
In Java the base size of an object is fairly large (several 10's of
bytes IIRC) so even though many of the objects involved are small
this overhead adds up quickly. If someone can find a good way to
cut this I'm all ears.
Don't be fooled into thinking that a 'line' element is 4 floats
though!
I will mention that you will be much better served putting all
the line elements into one 'big' path/polyline element (although
115 lines is not that big for a path/polyline). I suspect that
you need the individual lines for some reason? Hit testing?
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]