xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Archie Cobbs" <arc...@dellroad.org>
Subject Re: OutOfMemoryError: Does Batik automatically cache SVG files?
Date Tue, 15 Jan 2008 22:37:58 GMT
Just because the memory usage stays high that doesn't mean there is a memory
leak.. because Batik (and other classes) use weak and soft references to
cache stuff.

If you eventually get an OOM no matter what the max heap size, then that's a
memory leak. But you don't know what's the culprit unless you do a heap
analysis, e.g. try "jmap -histo", etc.

On Jan 15, 2008 4:26 PM, ACE91 <adamlego20@hotmail.com> wrote:

>
> Hello again.
>
> I have finished my Batik-powered game (you can play it at my website,
> sector91.com), but it tends to cause OutOfMemoryErrors. The game loads
> dozens of different SVG and SVGZ files, but for the most part they all
> exist
> as local variables within functions and therefore should be deallocated
> after they're not being used, so I don't know why this occurs.
>
> So I watched the game's memory usage with Task Manager, and the memory
> usage
> seems to go up when each file is loaded and then NOT go back down when
> that
> file is no longer shown on the JSVGCanvas. (However, the same file never
> increments the memory more than once, making me think this is some sore of
> caching.) Why does this happen? As far as I know, there are no dangling
> references to the SVGDocument objects that I'm creating. Does Batik
> automatically cache SVG documents that it builds? And is there a way to
> disable this?
>
> If you want to know some specifics about my program, it preloads a bunch
> of
> SVG files into String variables when it starts, but this is never done
> more
> than once, so that's no reason for so much memory to be used. It creates
> SVG
> files with SAXSVGDocumentFactory using these strings instead of
> redownloading the files. The game does use double-buffered rendering,
> which
> I saw cited in another message as a cause of excessive memory usage, but I
> can't disable it without causing a lot of flickering around the game's
> animations.
> --
> View this message in context:
> http://www.nabble.com/OutOfMemoryError%3A-Does-Batik-automatically-cache-SVG-files--tp14849191p14849191.html
> Sent from the Batik - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>
>


-- 
Archie L. Cobbs

Mime
View raw message