-
-
Notifications
You must be signed in to change notification settings - Fork 939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary finalizers #1209
Conversation
All of the finalizers in the library are no-ops, but their existence means that when Dispose (and thus GC.SuppressFinalize) is not called, the objects' lifetimes are extended unnecessarily while they are waiting to be finalized.
I could be wrong, but I think that if we call https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose |
You are correct. The PR is just small clean-up in the case that |
@drieseng What do you think about this PR. |
I'm ok with removing the finalizer when there's no added value, but it made sense to keep the finalizer for the few cases I reviewed (BaseClient, SftpFileReader and PasswordConnectionInfo). |
None of them make use of any unmanaged resources, so it doesn't make sense for them to have finalizers. |
# Conflicts: # src/Renci.SshNet/Security/Cryptography/EcdsaDigitalSignature.cs
All of the finalizers in the library are no-ops, but their existence means that when
Dispose
(and thusGC.SuppressFinalize
) is not called, the objects' lifetimes are extended unnecessarily while they are waiting to be finalized.