You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Renci is leaking SocketAsyncEventArgs objects when compiled with the FEATURE_SOCKET_EAP flag (seems to be the default build configuration). When compiled without FEATURE_SOCKET_EAP the leak goes away (naturally).
Perhaps this is caused by the use of the SetBuffer-method which according to http://codefruits.blogspot.dk/2013/03/memory-leak-in-c-net-sockets.html must be nulled (SetBuffer(null, 0, 0)) to be garbage collected correctly.
For some reason we didn't see this leak on Windows Server 2008 but when we recently moved our production to Windows Server 2012 the Windows NT service using Renci.SSHNET started to leak 100 MiB a day.
The text was updated successfully, but these errors were encountered:
I can confirm that 2016.1.0-beta1 seems to have fixed this issue.
For reference the leak can be reproduced on 2016.0.0 simply by running:
class Program
{
static void Main(string[] args)
{
using (
var sftpClient = new SftpClient("xxtest-server", "myuser",
new PrivateKeyFile("test.key")))
{
sftpClient.Connect();
var files = sftpClient.ListDirectory("/test");
Console.WriteLine(files.Count());
sftpClient.Disconnect();
}
GC.Collect();
GC.WaitForPendingFinalizers();
Console.ReadLine(); // Create memory dump at this point and check for SocketAsyncEventArgs instances
}
}
Renci is leaking SocketAsyncEventArgs objects when compiled with the FEATURE_SOCKET_EAP flag (seems to be the default build configuration). When compiled without FEATURE_SOCKET_EAP the leak goes away (naturally).
Perhaps this is caused by the use of the SetBuffer-method which according to http://codefruits.blogspot.dk/2013/03/memory-leak-in-c-net-sockets.html must be nulled (SetBuffer(null, 0, 0)) to be garbage collected correctly.
For some reason we didn't see this leak on Windows Server 2008 but when we recently moved our production to Windows Server 2012 the Windows NT service using Renci.SSHNET started to leak 100 MiB a day.
The text was updated successfully, but these errors were encountered: