Uh oh!
There was an error while loading. Please reload this page.
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.
WojciechNagorski
commented
Oct 17, 2023
I could be wrong, but I think that if we call https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/implementing-dispose |
Rob-Hague
commented
Oct 17, 2023
You are correct. The PR is just small clean-up in the case that |
WojciechNagorski
commented
Oct 18, 2023
@drieseng What do you think about this PR. |
drieseng
commented
Oct 30, 2023
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). |
Rob-Hague
commented
Oct 30, 2023
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.