G
Guest
Hi,
I've been having problem with a socket listener as a windows service consuming all available memory. The following code reproduces my problem:
Dim lSocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)
lSocket.Bind(New IPEndPoint(IPAddress.Any, 16005))
lSocket.Listen(5)
While (True)
Dim cSocket As Socket = lSocket.Accept
cSocket = lSocket.Accept
cSocket.Shutdown(SocketShutdown.Both)
cSocket.Close()
CType(cSocket, IDisposable).Dispose()
cSocket = Nothing
End While
Running this code from a button on a form and making 100's of sequencial connections to the listen socket causes the process to consume 4-8k of memory about every 6-8 connections. This memory is never freed.
Im using .net 1.1 and VB on Windows 2k Pro. Is this a memory leak in .net or a GC problem? Should I be looking at making calls to the GC?
Regards, Ben.
I've been having problem with a socket listener as a windows service consuming all available memory. The following code reproduces my problem:
Dim lSocket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)
lSocket.Bind(New IPEndPoint(IPAddress.Any, 16005))
lSocket.Listen(5)
While (True)
Dim cSocket As Socket = lSocket.Accept
cSocket = lSocket.Accept
cSocket.Shutdown(SocketShutdown.Both)
cSocket.Close()
CType(cSocket, IDisposable).Dispose()
cSocket = Nothing
End While
Running this code from a button on a form and making 100's of sequencial connections to the listen socket causes the process to consume 4-8k of memory about every 6-8 connections. This memory is never freed.
Im using .net 1.1 and VB on Windows 2k Pro. Is this a memory leak in .net or a GC problem? Should I be looking at making calls to the GC?
Regards, Ben.