Torrs
January 29th, 2010, 06:56 AM
Hello,
We have a small service shows continuous nonpaged pool bytes increase from the moment it is started. This is only on a 2008 server (all the others work fine).
The service basically connects a socket to a client to see if it's successful and then closes (most code omitted):
Try
client = New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
client.LingerState = New System.Net.Sockets.LingerOption(False, 0)
client.ReceiveBufferSize = 1024
client.SendBufferSize = 1024
client.Connect(address, _port)
Catch
Finally
'Release the socket.
If client IsNot Nothing AndAlso client.Connected Then
client.Shutdown(System.Net.Sockets.SocketShutdown.Both)
client.Disconnect(True)
client.Close(5)
client = Nothing
End If
It does also call an asynchronous BeginReceive() but I've commented that part out and the leak is still evident. The code is inside a timer, and gets called by a configurable amount. I've tried many things in code, and also upgrading the project to use the 3.5 Framework combined with the suggestions here:
http://msdn.microsoft.com/en-us/magazine/cc163356.aspx
But it still increases by 15.36 bytes every iteration. Some resources just aren't being released?!
Many thanks in advance,
Phil
We have a small service shows continuous nonpaged pool bytes increase from the moment it is started. This is only on a 2008 server (all the others work fine).
The service basically connects a socket to a client to see if it's successful and then closes (most code omitted):
Try
client = New System.Net.Sockets.Socket(System.Net.Sockets.AddressFamily.InterNetwork, System.Net.Sockets.SocketType.Stream, System.Net.Sockets.ProtocolType.Tcp)
client.LingerState = New System.Net.Sockets.LingerOption(False, 0)
client.ReceiveBufferSize = 1024
client.SendBufferSize = 1024
client.Connect(address, _port)
Catch
Finally
'Release the socket.
If client IsNot Nothing AndAlso client.Connected Then
client.Shutdown(System.Net.Sockets.SocketShutdown.Both)
client.Disconnect(True)
client.Close(5)
client = Nothing
End If
It does also call an asynchronous BeginReceive() but I've commented that part out and the leak is still evident. The code is inside a timer, and gets called by a configurable amount. I've tried many things in code, and also upgrading the project to use the 3.5 Framework combined with the suggestions here:
http://msdn.microsoft.com/en-us/magazine/cc163356.aspx
But it still increases by 15.36 bytes every iteration. Some resources just aren't being released?!
Many thanks in advance,
Phil