xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorg Heymans ...@domek.be>
Subject Re: java.lang.OutOfMemoryError
Date Mon, 06 Dec 2004 15:30:26 GMT
maybe you could post your update() method , it might a few extra clues 
as to what is exactly happening.

Also: isolating out a testcase of 2-3 classes that can reproduce the 
problem would help tremendously in getting to the bottom of this.

Regards
Jorg

Tang, Charlie Y. wrote:
> Hi
> 
>  
> 
> I have a problem of OutofMemoryError when updating my screen 
> continuously every second after about a day or so
> 
>            
> 
>  
> 
> Below is the thread that does all the updating
> 
> /**
> 
>              * This thread will take care of updating the Dom structure
> 
>              * and the object
> 
>              */        
> 
>             public class RunUpdate extends Thread
> 
>             {
> 
>                         int delay;
> 
>                         private boolean threadSuspended;
> 
>                         RunnableUpdate ru = new RunnableUpdate();
> 
>            
> 
>                         RunUpdate(int d)
> 
>                         {
> 
>                                     delay = d;
> 
>                                     threadSuspended = false;
> 
>                         }
> 
>                        
> 
>                         public synchronized void pausethread()
> 
>                         {
> 
>                                     if(!threadSuspended){
> 
>                                                 threadSuspended = true;
> 
>                                                 notify();
> 
>                                     }
> 
>                                    
> 
>                         }
> 
>                         public synchronized void resumethread()
> 
>                         {
> 
>                                     if(threadSuspended){
> 
>                                                 threadSuspended = false;
> 
>                                                 notify();
> 
>                                     }
> 
>                         }
> 
>                        
> 
>                        
> 
>                         public void run(){
> 
>                                                
> 
>                                    
> 
>                     while (true) {
> 
>                         try {     
> 
>                        
> 
>                             if (threadSuspended) {
> 
>                                 synchronized(this) {
> 
>                                     while (threadSuspended)
> 
>                                         wait();
> 
>                                 }
> 
>                             }
> 
>                            //Need by Batik inorder to refresh the svg canvas
> 
>                                     Thread.sleep (delay);
> 
>                                     um = svgc.getUpdateManager();
> 
>                                     System.gc();         
>                    
> 
>                                    
> 
>                                     
> um.getUpdateRunnableQueue().invokeAndWait(ru);          
> 
>                                                  
> 
>                         } catch (InterruptedException e){
> 
>                                     System.out.println("RunUpdate over");
> 
>                         }catch (java.lang.OutOfMemoryError err ){ //in 
> case of memory error
> 
>                                     
> System.exit(1);                                                 
> 
>                         }                     
> 
>                     }
> 
>                         }
> 
>                        
> 
>                         public class RunnableUpdate implements Runnable
> 
>                         {
> 
>                                     public void run(){            
> 
>                                                 update();            
> //method to update the dom structure     
> 
>                                     }            
> 
>                         }
> 
>             }                                  
> 
>  
> 
>  
> 
> I’m guessing the problem is the RunnableUpdate ru added to the 
> RunnableQueue causes a RunnableQueue.Link object to be created to link 
> to every Runnable Update
> 
> And that does not get deleted eventhough there is only one instances of 
> RunnableUpdate and that’s ru. ? is there a way to update my screen 
> continuously and indefinately?
> 
> Thanks a lot
> 
>  
> 
> Charlie Tang
> 


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


Mime
View raw message