On Thursday 20 December 2001 00:42, Jenny Liu wrote:

> We plug batik into our system as a java bean to view our svg documents. And
> we still have out of memory problem.
>
> It can be reproduced by using batik svgbrowser as follows.

OK, so there are several things to say.

[A]
The good news is that batik does *not* have a memory leak. You can load again 
and again your document in our browser.

[B] Your document is big (2600x2000). The JSVGCanvas by default automatically 
adapts its size to the size of the document. So the first time, the offsceen 
image we create is 2600x2000 big.

Then when you change documents (or reload for example), if the double 
buffering option is activated - the first image is kept until the new 
document is finished (so 2 big images are in memory - during that phase only 
but that's enough to go to OutOfMemoryException).

[C] The JScrollPane is not the proper way to add scrollbar to the canvas 
because the JScrollPabe sets to its enclosed component its preferred size 
(which is the size of the SVG document in our case).

You should consider subclassing the JSVGCanvas and implement the 
javax.swing.Scrollable interface (or see our the MVC works with scrollbar in 
swing) to pan when you use scrollbar (instead of scrolling on a big buffered 
image).

[D] If you grow the memory of the VM (using -X... options), you should be 
able to reload your document as many times you want.


Hope that helps.

Thierry.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to