Repository navigation
Conversation
Author
WattsUp
force-pushed
the
bugfix/memory-leak
branch
from
February 12, 2026 19:05
c6b59fc to
64f5957
Compare
|
noticed the same issue with transport.stop_thread. Would be nice to see this merged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




SSHClients do not release all their memory after close. This patch helps Python realize objects are not referenced and can be freed.
Transport
stop_thread():packetizer.close()is called which setspacketizer.closedtoTrueand prevents the following while loop from every evaluating. I removedpacketizer.closedclause from while loopTransport
_handler_table: Python got confused with a dict of function pointers and didn't automatically free them. I cleared_handler_tablewhen complete.Transport
_filter_algorithms(): It would deep copy the algorithms every time regardless of if filtering was necessary. I added a check to return the unfiltered tuple if able.HostKeys
lookup(): The anonymous classSubDicthad a reference tohostnamewhich led it to be unique for each call and require unique allocation. I moved the class outside of the function call and repaired thehostnamereference.