You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-users@xmlgraphics.apache.org by Marc Doerflinger <ma...@diligent-it.com> on 2007/06/11 12:02:48 UTC
cleaning up jsvgcanvas
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hello batik-users!
when i load a svg document into the jsvgcanvas through the setDocument()
method a lot of instances of classes in org.apache.batik.gvt.* are
created (in my case multiple thousand).
When i load another document onto the same canvas, those gvt elements
are not disposed, they stay in the memory. garbage collection does not
collect them. i think if i load the same document again, no new ones are
created, but since i load a lot of different documents, this is would be
a major memory leak.
is there a way to correctly unload a svg document from the canvas so i
can reuse it without instantiating a new one? setDocument(null) displays
an empty canvas again, but i does not clean up the gvt object. is there
a way to get rid of them? maybe something like a clean up or garbage
collection for unused gvt elements?
removing and reinstantiating the jsvgcanvas would be insanly complex,
since (as i mentioned in mails before) i use the svgcanvas within a swt
app and the swt-awt bridge has some issues with cleanly removing awt
objects, so i try to reuse objects whenever possible to avoid memory leaks.
thanks,
marc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGbR3I6mRZxtk0FrcRAom+AKDYkgVB/tQm1xFyNKD3icl8ulPIuwCg0ufG
YzQ4T2h+V4/167g3rGoXZBY=
=a9Bk
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
Re: cleaning up jsvgcanvas
Posted by Marc Doerflinger <ma...@diligent-it.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
hello batik-users!
i solved my problem. another part of my application which executes the
svgloader.loaddocument() and generates the svgdocument object kept a
record of all loaded documents (probebly for caching). the jscgcanvas
kep some references to those documents and therefore was not collected
correctly. after removing this "cache" it worked fine. memory
consumption is down to a frightning low level. ;-)
cheers,
marc
Marc Doerflinger wrote:
> hello batik-users!
>
> when i load a svg document into the jsvgcanvas through the setDocument()
> method a lot of instances of classes in org.apache.batik.gvt.* are
> created (in my case multiple thousand).
> When i load another document onto the same canvas, those gvt elements
> are not disposed, they stay in the memory. garbage collection does not
> collect them. i think if i load the same document again, no new ones are
> created, but since i load a lot of different documents, this is would be
> a major memory leak.
> is there a way to correctly unload a svg document from the canvas so i
> can reuse it without instantiating a new one? setDocument(null) displays
> an empty canvas again, but i does not clean up the gvt object. is there
> a way to get rid of them? maybe something like a clean up or garbage
> collection for unused gvt elements?
> removing and reinstantiating the jsvgcanvas would be insanly complex,
> since (as i mentioned in mails before) i use the svgcanvas within a swt
> app and the swt-awt bridge has some issues with cleanly removing awt
> objects, so i try to reuse objects whenever possible to avoid memory leaks.
>
> thanks,
> marc
- ---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFGbrE36mRZxtk0FrcRAlsxAKC0lAjnbjipwTgy/rmVU3eLJJIz/gCfd+aZ
bCn3HtYkIU3kpMUMNedW5eI=
=uhq1
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org