Hi Chandrashekar,
chandrashekar srinivasan wrote:
The svg files Iam dealing with are maps. one file which is just a collection of svg images (compressed ) takes up 53MB of memory. there is another file (the decompressed size is 3.4MB!!!!) which consumes 133MB.
An expansion factor of ~10-20x for in memory usage seems normal for SVG. Your 3.4MB example has a 30-40x this would be understandable if it contains lots of symbols. In general Batik tends to err towards replication rather than recalculation (so it holds a copy of the stroked geometry for hit testing etc).
If you drop the Document tree and just keep the GVT tree (which as I said may require modifying the way text is handled slightly) you could probably save a significant portion of this although I doubt it would be half.
The lowest memory hogging svg file I have is a floor map which takes up 8MB. Now is this typical of java swing desktop applications using SVGs heavily with JSVGCanvas?
These are what would generally be considered large SVG files. You can't use your experience with raster image sizes when comparing with SVG. Also there is a tendency to put everything in one large SVG file which is convenient but it takes up a lot of memory. Batik supports the multi-image element which would allow you to have multiple levels of detail and tiling so all the image data doesn't have to be loaded at once.
These numbers I got using Squiggle browser(1.5.1). I haven't tried batik 1.6 yet. I will soon.
I can attach the files if you want to take a look. let me know. I am setting the doublebuffered option to off.
Thanks a lot.
>From: Thomas DeWeese <[EMAIL PROTECTED]>
>Reply-To: [email protected]
>To: [email protected]
>Subject: Re: How to keep memory foot print small for a svg document in JSVGCanvas
>Date: Fri, 06 May 2005 06:02:37 -0400
>
>chandrashekar srinivasan wrote:
>
>>1) I have a svg document which when rendered onto the JSVGCanvas
>>takes up lot of memory.
>
> Do you know why it takes up lots of memory?
>
>>I need to display the document only when a user invokes a menu
>>item. Is there any way I could keep the document object bound to
>>JSVGCanvas but only render when I show the canvas. again when the
>>canvas is closed, free some memory. anything I could do with
>>staticrenderer?
>
> One of the larger chunks of memory for the canvas is it's
>offscreen
>buffer (it may have two if you have double buffering set). If you
>shrink the canvas size I think the offscreen buffers will shrink as
>well. Ideally if you rendered statically you could drop the DOM
>completely and just keep the GVT tree. This doesn't quite work in
>practice because Text keeps a reference to the DOM in order to
>resolve
>SVG Fonts (which is done at render time - for a variety of reasons).
>If you didn't care about this you could probably 'fix' this locally.
>
>>2) also what is the best way to reduce/erase memory footprint for a
>>document loaded in JSVGCanvas, if I don't care for caching. also I
>>keep loading diffferent documents onto the canvas one after the
>>other.
>
> First off you should be using Batik 1.6 there were at least two
>significant memory leaks that were fixed in this area.
>
> With Batik 1.6 I don't think there is much to do the 'cache' of
>documents uses Soft References so under memory pressure the cached
>documents will be dropped from the system. Really the thing to do
>is profile things a bit and if you notice something that doesn't
>look right to you post it to this list and we can see if there is
>an opportunity to reduce memory usage.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail:
>[EMAIL PROTECTED]
>For additional commands, e-mail:
>[EMAIL PROTECTED]
>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
