dev@glassfish.java.net

Potential memory leak

From: Roman Pokhodzhai <rpohod_at_gmail.com>
Date: Mon, 19 Jan 2009 17:24:37 +0200

Hello All,

I'm using GV2U2 and have problem with memory leak.
I found strange code in Switch.java : line 221 :

 public Timer getTimer() {
        synchronized( getTimerLock ) {
            if( timer == null ) {
                // Create a scheduler as a daemon so it
                // won't prevent process from exiting.
                timer = new Timer(true);
            }
        }
        return timer;
    }

Nice comment there : "so it won't prevent process from exiting", but
it will prevent classloader from collecting (as far as timer thread
keep reference to the context classloader). In this case I'm not able
to undeploy application completely because a lot of classes won't be
unloaded, hence PermGen OutOfMemory is thrown.

Any comments, suggestions, etc?