You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by Andreas Junius <An...@sydac.com.au> on 2010/08/25 02:38:58 UTC

Threads causing memory leaks

Hi Batik developers,

My name is Andreas and I'm new on this list. I have been working on a
train driver simulator using batik for more than 6 months and I admit it
wasn't always easy. The application runs within a container and gets
started and stopped several times. This caused some trouble, because
batik creates a lot of threads, which don't stop when a batik component
has been removed. I added a fix to the
org.apache.batik.util.CleanerThread:

public void run() {
    Reference ref = null;
    boolean alive = Boolean.TRUE;
    // make this thread interruptable
    while (alive) {
      try {
        if (queue != null) {
          ref = queue.remove();
          if (ref instanceof ReferenceCleared) {
            ReferenceCleared rc = (ReferenceCleared)ref;
            rc.cleared();
          }
        }
      } catch (InterruptedException e) {
        queue = null;
        thread = null;
        alive = Boolean.FALSE;
        Thread.currentThread().interrupt(); // restore interruption
status
      }
    }
  }


This fix works fine, though there are other threads causing similar
trouble:

95, RunnableQueue-0, class org.apache.batik.util.HaltingThread, WAITING,
true, true
96, Timer-0, class java.util.TimerThread, WAITING, true, true     <--
where is the Timer used?


It would be easier for me if someone can tell me where these threads are
started and if there are means to stop them (because
HaltingThread.halt() doesn't seem to work). Maybe it is possible to
meake these threads interruptable as well?

Any hints highly appreciated!

Cheers,

	Andreas

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