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 th...@kodak.com on 2007/12/07 04:23:39 UTC

Re: OutOfMemoryError Problem in Batik

Hi Qian,

"Qian Li" <qi...@googlemail.com> wrote on 11/23/2007 07:24:42 AM:

> I sometime hit the OutOfMemoryError exception, it's only happen once
> in about ten runs, doesn't happen in very run I do.
> 
> I have already set the argument to -Xms128m -Xmx328m .
> And I also use a script to check the memory usage. Below is the
> printout of the memory usage when it crashes, it just happened during
> the big increase in memory. In some runs the memory can go a lot
> higher than this without crashing at all. Does anyone know what may
> causing this problem?

    It looks like it's Batik allocating it's offscreen rendering
buffer.  Depending on how you have your Swing app configured
this could be a very large buffer.  One thing is that Batik
normally maintains two offscreen buffers (one for rendering into
one for updating the screen).  You could try putting the canvas
into single buffer mode; canvas.setDoubleBufferedRendering(false).

    Also if you have the canvas in a normal JScrollPane instead
of our JSVGScrollPane the canvas will grow to the full size of
the SVG document which could be gigantic.


> Memory Print out:
> Printed using: ps aux | grep $1 | grep -v grep | awk '{print $5}'
> ###############################################
> 
> framework.Main 487896 Fri Nov 23 11:21:17 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:19 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:21 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:23 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:25 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:27 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:29 GMT 2007
> framework.Main 493484 Fri Nov 23 11:21:31 GMT 2007
> framework.Main 507256 Fri Nov 23 11:21:33 GMT 2007
> framework.Main 507256 Fri Nov 23 11:21:35 GMT 2007
> framework.Main 499764 Fri Nov 23 11:21:37 GMT 2007
> framework.Main 499764 Fri Nov 23 11:21:39 GMT 2007
> framework.Main 499764 Fri Nov 23 11:21:41 GMT 2007
> 
> ##################################################
> Here is the Exception::
> java.lang.OutOfMemoryError: Java heap space
>        at java.awt.image.DataBufferInt.<init>(DataBufferInt.java:41)
>        at java.awt.image.SinglePixelPackedSampleModel.
> createDataBuffer(SinglePixelPackedSampleModel.java:220)
>        at java.awt.image.Raster.createWritableRaster(Raster.java:938)
>        at org.apache.batik.gvt.renderer.DynamicRenderer.
> updateWorkingBuffers(Unknown
> Source)
>        at org.apache.batik.gvt.renderer.DynamicRenderer.
> repaint(Unknown Source)
>        at org.apache.batik.gvt.renderer.StaticRenderer.repaint(Unknown 
Source)
>        at org.apache.batik.swing.gvt.GVTTreeRenderer.run(Unknown Source)
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
>