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 LASSINOT Frédéric - NAN <fr...@atosorigin.com> on 2010/07/02 17:26:57 UTC

OutOfMemoryError when loading applet several times

Hi,

 

We are experiencing problems with the use of Batik to display a large SVG in
an applet.

 

What happens is this :

The user connects and the application displays the page, the applet is
loaded by the browser. The applet requests the SVG from a Servlet and then
displays it using Batik.

Then the user clicks on a link in the application or in the rendered SVG and
the browser displays another page.

Finally the user clicks on a link in the menu which redirects to the first
page that loads the applet again.

After repeating the same tasks several times (from 5 to 20, it depends) the
applet crashes or waits indefinitely for the SVG.

When the applet “waits” indefinitely (or a very long time : 2 minutes), it
is trying to download the applet or the SVG (one of the two).

 

Here is the stack trace for the crash (HEAP) :

 

Exception in thread "Thread-61" java.lang.OutOfMemoryError: Java heap space

            at java.awt.image.DataBufferInt.<init>(Unknown Source)

            at java.awt.image.Raster.createPackedRaster(Unknown Source)

            at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown
Source)

            at java.awt.image.BufferedImage.<init>(Unknown Source)

            at sun.java2d.loops.GraphicsPrimitive.convertFrom(Unknown
Source)

            at sun.java2d.loops.MaskBlit$General.MaskBlit(Unknown Source)

            at sun.java2d.loops.Blit$GeneralMaskBlit.Blit(Unknown Source)

            at sun.java2d.pipe.DrawImage.blitSurfaceData(Unknown Source)

            at sun.java2d.pipe.DrawImage.renderImageCopy(Unknown Source)

            at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)

            at sun.java2d.pipe.DrawImage.copyImage(Unknown Source)

            at sun.java2d.pipe.ValidatePipe.copyImage(Unknown Source)

            at sun.java2d.SunGraphics2D.drawImage(Unknown Source)

            at sun.java2d.SunGraphics2D.drawImage(Unknown Source)

            at sun.plugin.util.AnimationPanel2.doPaint(Unknown Source)

            at sun.plugin.util.AnimationPanel2.run(Unknown Source)

            at java.lang.Thread.run(Unknown Source)

 

or this (Permgen) :

 

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

            at
sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)

            at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown
Source)

            at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)

            at java.security.AccessController.doPrivileged(Native Method)

            at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown
Source)

            at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)

            at java.lang.ClassLoader.loadClass(Unknown Source)

            at java.lang.ClassLoader.loadClass(Unknown Source)

            at
org.apache.batik.bridge.UpdateManager.<init>(UpdateManager.java:161)

            at
org.apache.batik.swing.svg.AbstractJSVGComponent.startSVGLoadEventDispatcher
(AbstractJSVGComponent.java:878)

            at
org.apache.batik.swing.svg.AbstractJSVGComponent$SVGListener.gvtBuildComplet
ed(AbstractJSVGComponent.java:1537)

            at
org.apache.batik.swing.svg.GVTTreeBuilder$2.dispatch(GVTTreeBuilder.java:163
)

            at
org.apache.batik.util.EventDispatcher.dispatchEvent(EventDispatcher.java:103
)

            at
org.apache.batik.util.EventDispatcher.fireEvent(EventDispatcher.java:87)

            at
org.apache.batik.util.EventDispatcher$1.run(EventDispatcher.java:46)

            at java.awt.event.InvocationEvent.dispatch(Unknown Source)

            at java.awt.EventQueue.dispatchEvent(Unknown Source)

            at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)

            at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown
Source)

            at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)

            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

            at java.awt.EventDispatchThread.run(Unknown Source)

Caused by: java.lang.reflect.InvocationTargetException

            at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)

            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)

            at java.lang.reflect.Method.invoke(Unknown Source)

            ... 23 more

Caused by: java.lang.OutOfMemoryError: PermGen space

            at java.lang.ClassLoader.defineClass1(Native Method)

            at java.lang.ClassLoader.defineClassCond(Unknown Source)

            at java.lang.ClassLoader.defineClass(Unknown Source)

            at java.security.SecureClassLoader.defineClass(Unknown Source)

            at java.net.URLClassLoader.defineClass(Unknown Source)

            at java.net.URLClassLoader.defineClass(Unknown Source)

            ... 26 more

 

We have tried increasing the maximum Heap size (1024m) and MaxPermGen (256m)
but it crashes nonetheless.

 

Technical details :

OS : Windows XP Pro SP2

Installed JREs :

            1.6.0_19 checked

1.6.0_07 checked

1.5.0_16 checked

1.5.0_14 not checked

1.4.2_16 not checked

“Checked” refers to the Java Runtime Environment Settins in the
configuration panel)

(we have tried several combinations, but none solves the problem)

Browser : IE 6.0.2900

(it also crashes in Firefox)

 

 


RE: OutOfMemoryError when loading applet several times

Posted by Julien Beghin <mi...@hotmail.com>.
Hello Frederic !

 

I have same problems when using batik, or Squiggle to open big SVG.

 

What we did was only to change memory parameters of JVM. -Xms128m -Xmx256m for instance.

 

It works with that, and I hope that it will help you.

 

Maybe you should also "nullify" all unused ressources if there are...


 


To: batik-users@xmlgraphics.apache.org
Subject: Re: OutOfMemoryError when loading applet several times
From: thomas.deweese@kodak.com
Date: Wed, 7 Jul 2010 06:10:09 -0400

Hi Frederic, 

LASSINOT Frédéric - NAN <fr...@atosorigin.com> wrote on 07/02/2010 11:26:57 AM:

> The user connects and the application displays the page, the applet 
> is loaded by the browser. The applet requests the SVG from a Servlet
> and then displays it using Batik. 
> Then the user clicks on a link in the application or in the rendered
> SVG and the browser displays another page. 
> Finally the user clicks on a link in the menu which redirects to the
> first page that loads the applet again. 
> After repeating the same tasks several times (from 5 to 20, it 
> depends) the applet crashes or waits indefinitely for the SVG. 

   It sounds like something in your application isn't allowing the 
Applet to get garbage collected.  Since nothing should be preserved 
across Applet invocations I'm not sure what Batik would be doing to 
cause the issue. 

> Here is the stack trace for the crash (HEAP) : 

        This isn't very useful since the real problem is the fact 
that memory that was properly allocated isn't being freed by the 
garbage collector.  You need to figure out what is blocking that 
memory from being garbage collected. 
>  
 		 	   		  
_________________________________________________________________
Le nouveau Hotmail est presque arrivé, ne le manquez pas !
http://www.windowslive.fr/nouveau-hotmail/

Re: OutOfMemoryError when loading applet several times

Posted by th...@kodak.com.
Hi Frederic,

LASSINOT Frédéric - NAN <fr...@atosorigin.com> wrote on 
07/02/2010 11:26:57 AM:

> The user connects and the application displays the page, the applet 
> is loaded by the browser. The applet requests the SVG from a Servlet
> and then displays it using Batik.
> Then the user clicks on a link in the application or in the rendered
> SVG and the browser displays another page.
> Finally the user clicks on a link in the menu which redirects to the
> first page that loads the applet again.
> After repeating the same tasks several times (from 5 to 20, it 
> depends) the applet crashes or waits indefinitely for the SVG.

   It sounds like something in your application isn't allowing the
Applet to get garbage collected.  Since nothing should be preserved
across Applet invocations I'm not sure what Batik would be doing to
cause the issue.

> Here is the stack trace for the crash (HEAP) :

        This isn't very useful since the real problem is the fact
that memory that was properly allocated isn't being freed by the
garbage collector.  You need to figure out what is blocking that
memory from being garbage collected.
>