Not sure if it's completely relevant, but nearly every time I've run
into the out of memory error in a non-production environment, I've
always boosted the memory allocation using -Xms and -Xmx. See
http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/java.html for
more.
Not a best practice, I'm sure, but it has worked...
On Wed, 1 Dec 2004 09:55:36 -0500, Tang, Charlie Y.
<[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]