[jboss-user] [Remoting] - Re: Memory leak in remoting objects

ron.sigal@jboss.com do-not-reply at jboss.com
Tue May 13 21:01:36 EDT 2008


Hey Trustin,

I'm seeing something different.  When I run


  |       for (int i = 0; i < 1000; i++)
  |       {
  |          Client client = new Client(clientLocator, clientConfig);
  |          client.connect();
  |          TestCallbackHandler callbackHandler = new TestCallbackHandler();
  |          client.addListener(callbackHandler, null, null, true);
  | //         client.removeListener(callbackHandler);
  |          client.disconnect();
  |       }
  | 

I get lots of BisocketClientInvokers and BisocketClientInvoker.PingTimerTasks hanging around.  When I uncomment the client.removeListener() line, I see something different. In particular, I still see lots of BisocketClientInvokers hanging around, but the only reference to them is a java.lang.ref.Finalizer weak reference.  For some reason, when I force a garbage collection in JProfiler, the garbage collector doesn't collect them.  Maybe the program isn't running long enough to do a full garbage collection? When the program concludes (but stays alive in JProfiler) I can garbage collect all of the BisocketClientInvokers and PingTimerTasks.

What I just described happens in Windows with jdk 1.5.  When I run the same program in linux, the garbage collector is willing to collect the old BisocketClientInvokers, even when the program is still running.

So it doesn't look like a real leak to me, as long as the program properly disposes of its connections.  It looks more like an artifact of the garbage collector behavior.

-Ron


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150567#4150567

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4150567



More information about the jboss-user mailing list