Hi Shamjith,
Shamjith K V <[EMAIL PROTECTED]> wrote on 09/26/2006 07:31:48 AM:
> I have a doubt in the garbage collection in JSVGCanvas.
> My doubt is if I reuse a JSVGCanvas for rendering a different svg
> file, whether the memory used for the previous svg will be
> released?.
For the Batik 1.6 release I am fairly confident that all
memory associated with the previous svg will be released
(we did a bunch of very aggressive memory leak tests to
track down a few leaks).
With the current SVN code I am less sure that _all_
memory will be released (I have seen one or two instances
where it looked like we might have a _small_ leak), however
certainly the vast majority of the memory is released.
> What I meant is:
> If I have a first case like,
> svgCanvas.setURI(new java.io.File("test1.svg").toURL().toString());
> ..and in a later time I use the same JSVGCanvas object
> svgCanvas.setURI(new java.io.File("test2.svg").toURL().toString());
> Whether the memory allocated for the previous canvas will be released?.
>
> What I found was that, after setting the URI to a new one, the memory
used by
> the particular process is increasing(even if the svg file content is
same the
> difference is only in file name).
Like many other things in Java you need to have a fairly deep
understanding of how Java does things to make tests like the above.
In particular Java use Garbage collection and more specifically
a generational Garbage collector. This means that often the JVM
will not reclaim memory until there is memory pressure. I typically
do a quick check of memory leaks by bringing Batik - squiggle up with
a document and showing the memory monitor (Tools->Memory Monitor)
then repeatedly reloading the document. The memory monitor will
sawtooth up and down. The thing you are looking for is if after
a little while the 'low water' mark settles.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]