Because the RSACryptoServiceProvider object is never disposed, program using this library will suffer from memory leak. This can easily be seen using this small sample program and watching its memory grow.
while (true)
{
var keygen = new SshKeyGenerator.SshKeyGenerator(2048);
var publicSshKey = keygen.ToRfcPublicKey();
}
Note that RSACryptoServiceProvider contains unmanaged resources.
Because the
RSACryptoServiceProvider
object is never disposed, program using this library will suffer from memory leak. This can easily be seen using this small sample program and watching its memory grow.Note that
RSACryptoServiceProvider
contains unmanaged resources.