You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Hervé Girod <he...@club-internet.fr> on 2005/05/30 12:11:14 UTC

Out of Memory error in Batik

Hello !

I use Batik in a Java application and have a Out of Memory error after 
opening and closing several times big XML files. I first thought the 
memory leak was due to my code, but I now think it is coming from Batik 
(not a 1.6 regression, because I had these Out of Memory errors before 1.6).

I used Netbeans with  the memory profiler with  the batik built-in SVG 
browser application (1.6 version), opening several times the "anne.svg" 
SVG file, and the profiler shows that the "live" objects are increasing 
for these classes, after each new opening :
- org.apache.batik.dom.GenericText
- org.apache.batik.dom.GenericAttr
- org.apache.batik.dom.AbstractElement.Entry
- org.apache.batik.dom.AbstractParentNode.ChildNodes
- org.apache.batik.dom.svg.SVGOMGElement
- org.apache.batik.dom.svg.SVGOMPathElement
- org.apache.batik.gvt.ShapeNode
- org.apache.batik.gvt.CompositeGraphicsNode
- org.apache.batik.gvt.event.GraphicsNodeChangeEvent
- org.apache.batik.ext.awt.geom.ExtendedGeneralPath
- org.apache.batik.dom.util.DocumentDescriptor.Entry

There is always one unique org.apache.batik.dom.svg.SVGOMDocument (same 
for org.apache.batik.dom.svg.SVGOMDefsElement, for example), so I think 
this is not coming from caching each previously opened SVG Documents.

I don't use the browser in my application, but I have the same results, 
so I think this is not coming from the browser itself...

Anyone has a hint on the reason of these memory leaks ?





---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: Out of Memory error in Batik

Posted by Hervé Girod <he...@club-internet.fr>.

Thomas DeWeese wrote:

> Hi Hervé
>
>    I would suspect that you are not cleaning up your
> listeners.  You either need to remove your listeners
> or make sure your listeners go to GC otherwise they
> can easily cause memory leaks.  At this point Batik
> has been pretty well tested for memory leaks and they
> generally involve complex scenarios, just loading a
> document repeatedly seems unlikely to cause the problem.

Thanks for the suggestion !! At the moment, I looked in my code and 
could not see where are my "faulty" listeners, but I think I must take a 
closer look... Sorry that I incorrectly put the fault on Batik, but you 
know, when he can't see easily where the problem lies in his own code, 
the user always try to blame others...

>
> Hervé Girod wrote:
>
>> I use Batik in a Java application and have a Out of Memory error 
>> after opening and closing several times big XML files.
>

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org


Re: Out of Memory error in Batik

Posted by Thomas DeWeese <Th...@Kodak.com>.
Hi Hervé

    I would suspect that you are not cleaning up your
listeners.  You either need to remove your listeners
or make sure your listeners go to GC otherwise they
can easily cause memory leaks.  At this point Batik
has been pretty well tested for memory leaks and they
generally involve complex scenarios, just loading a
document repeatedly seems unlikely to cause the problem.

Hervé Girod wrote:

> I use Batik in a Java application and have a Out of Memory error after 
> opening and closing several times big XML files. I first thought the 
> memory leak was due to my code, but I now think it is coming from Batik 
> (not a 1.6 regression, because I had these Out of Memory errors before 
> 1.6).
> 
> I used Netbeans with  the memory profiler with  the batik built-in SVG 
> browser application (1.6 version), opening several times the "anne.svg" 
> SVG file, and the profiler shows that the "live" objects are increasing 
> for these classes, after each new opening :
> - org.apache.batik.dom.GenericText
> - org.apache.batik.dom.GenericAttr
> - org.apache.batik.dom.AbstractElement.Entry
> - org.apache.batik.dom.AbstractParentNode.ChildNodes
> - org.apache.batik.dom.svg.SVGOMGElement
> - org.apache.batik.dom.svg.SVGOMPathElement
> - org.apache.batik.gvt.ShapeNode
> - org.apache.batik.gvt.CompositeGraphicsNode
> - org.apache.batik.gvt.event.GraphicsNodeChangeEvent
> - org.apache.batik.ext.awt.geom.ExtendedGeneralPath
> - org.apache.batik.dom.util.DocumentDescriptor.Entry
> 
> There is always one unique org.apache.batik.dom.svg.SVGOMDocument (same 
> for org.apache.batik.dom.svg.SVGOMDefsElement, for example), so I think 
> this is not coming from caching each previously opened SVG Documents.
> 
> I don't use the browser in my application, but I have the same results, 
> so I think this is not coming from the browser itself...
> 
> Anyone has a hint on the reason of these memory leaks ?
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-dev-help@xmlgraphics.apache.org