I had a similar problem in an application that used the .Net 2.0 framework. References to an IAsyncResult object were preventing the GC from collecting it. And the IAsyncResult AsyncWaitHandle needed to be closed. The following snippets of code show what I did to fix the problem.
socket.BeginAccept(new AsyncCallback(OnConnectionMade), socket);
private void OnConnectionMade(IAsyncResult asyn)
{
try
{
// complete connection and get socket object
Socket soc = ((Socket)asyn.AsyncState).EndAccept(asyn);
// recover resources
asyn.AsyncWaitHandle.Close();
I hope this helps.
Steve
!--removed tag-->
Enter your message below
Sign in or Join us (it's free).