Community
Participate
Working Groups
The static field AbstractChannel.listeners_array is used only temporarily for notifying IChannelListeners, but this keeps those listeners from being GC'ed (until the next channel event is fired). As listeners are often anonymous inner classes this can lead to quite serious memory leaks. I'd suggest to clear the array after notifying the listeners.
I have both removed "static" and changed the code to clear the array when the channel is closed or a listener is removed.
There is one problem, though: If a listener removes itself when it receives onChannelClosed(), all subsequent listeners will not receive the notification because the listeners_array is cleared.
Good catch. Looks like the original idea of reusing the array was wrong - it does not worth all the trouble. I have removed listeners_array and changed the code to create temporary array each time listeners are called. Thanks!
It looks like this was committed to master only, but not to 0.5.0 - is this intentional? http://git.eclipse.org/c/tcf/org.eclipse.tcf.git/commit/?id=da88b9a9263f5a97b98112dd7a600ffaf331a181
(In reply to comment #4) > It looks like this was committed to master only, but not to 0.5.0 - is this > intentional? The issue looks noncritical to me, but the fix can easily be backported to 0.5.0 if anyone needs it.