Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[dsdp-tm-dev] Possible memory leak in AbstractHostShellOutputReader

Hi,

I am using a SshHostShell in my application. For some reason, I cannot exit this shell at any time or else the target closes the whole connection. I suspect that my target node has a bad implementation of ssh, and it closes the session whenever you try to disconnect a channel of type "shell". It doesn't do that when you close a channel of type "sftp" for example.

Because of this, I keep the same SshHostShell for the whole duration of the target connection, and use writeToShell() to send commands and get the results from the standard output reader which is SshShellOutputReader, an extension of org.eclipse.rse.services.shells.AbstractHostShellOutputReader.

After some time, my application runs out of heap space. What happens is that the ArrayList _linesOfOutput in AbstractHostShellOutputReader only gets items added to it, it is never cleaned up of old lines. It can have hundreds of thousands of elements.

The ArrayList is read using HostShellChangeEvent.getLines(). It appears that all IHostShellOutputListener no longer need the event (and therefore, the lines) once they have processed it with shellOutputChanged(), but I don't know if this is a rule.

Could the ArrayList be cleaned up after firing the event to all the listeners? Or do we even need an ArrayList at all? From the source code, it looks like it was originally designed to allow firing events with a range of lines, but then was changed to fire an event with only a single line at a time.

Thanks,
Patrick

Back to the top