Hi Thomas,

Sorry for the wrong ordering below, my bad. The call is actually
canvas.stopProcessing(); 
canvas.dispose(); 

I hope that order is alright. I also have code removing the canvas from 
the applet:
this.getContentPane().remove(canvas);
canvas = null;

Any idea on console errors in the above scenario? Appreciate your help.

Thanks,
Praveen




[email protected] 
28/10/2009 04:12 PM
Please respond to
[email protected]


To
[email protected]
cc
[email protected]
Subject
Re: Canvas dispose






Hi Praveen, 

Praveen Nayak2 <[email protected]> wrote on 10/28/2009 02:46:10 AM:

> I have many pages each with an applet in it, with the SVG diagram, 
> and users can switch between these pages, sometimes quite rapidly. I
> noticed there was memory leaking away. I then included a call to 
> stopProcessing, which improved things. So I now have 
> canvas.dispose(); 
> canvas.stopProcessing(); 

    I don't think this is a good sequence.  I would stop at 
canvas.dispose().  The call to 'stopProcessing()' is actually 
likely acting to prevent the action of canvas.dispose(). 

    I've seen Swing hold onto the canvas much longer than 
desirable because it was the 'focus' component when it was 
not replaced by a new focus component.  So you might try 
removing the canvas from the applet and adding a JButton in 
it's place. 

> 1. Is this sufficient? 
> 
> Also, at times during navigation, I see errors such as these logged 
> in the console (I believe if I navigate away before the SVG is 
rendered): 
> java.lang.NullPointerException 

    These may be caused by your calling stopProcessing. 

Reply via email to