RE: GC and active sockets, and Pinned Memory

Tech-Archive recommends: Speed Up your PC by fixing your registry



Couldn't you just make sure that you included a distructor ~ClassName() into
your object that closes the socket on it's destruction?

"Arthur M." wrote:

> Bleh... I think I found the answer as to why, no solution as of yet though....
>
> When Socket.BeginReceive is called, buffer memory appears to be pinned,
> therefore it will never unpin it until some data shows and the call
> continues, the problem is that Socket.BeginReceive will call itself in the
> end of its call hence new buffer will get pinned, so unless GC tries to
> collect it at the moment when the call is completed but new one has not been
> initiated yet .... we have a hanging socket
>
> Anyone has any idea if there is a way to get reference count to an instance
> of a class from .NET?
>
>
>
> "Arthur M." wrote:
>
> > I'm using .net 2.0 beta2 and noticing some strange behaviour around socket
> > garbage collection.
> >
> > Problem:
> > If a socket is a part of a class which has been instantiated, socket
> > connected, and class de-referenced Socket will stay connected forever.
> >
> > Environment:
> > Sockets are doing async read/write
> >
> > Question:
> > How do i get it solved :) also - is putting something on IOCP thread will
> > cause garbage collection to fail because of internal blocking that is going
> > on. How can i clean up connected socket which is a member of a class which
> > suddenly lost refernece. Under normal conditions I do clean up, however,
> > there are scenarios where abnormal termination of a thread can cause socket's
> > parent class loose reference.
> >
> >
.



Relevant Pages

  • Re: incorrect errno/perror with IO::socket->new
    ... b> No I am expecting that Socket->newis making system calls and if ... b> I am left only with an undef $socket. ... b> clean up then saving it and restoring it after all clean up system ... your head and not the module. ...
    (comp.lang.perl.misc)
  • Re: OT: Networking with 3Com 3500...
    ... Contacts clean? ... Overdrive processor OK? ... it prevents the system from booting. ...
    (comp.sys.ibm.ps2.hardware)
  • RE: GC and active sockets, and Pinned Memory
    ... When Socket.BeginReceive is called, buffer memory appears to be pinned, ... > If a socket is a part of a class which has been instantiated, ... > cause garbage collection to fail because of internal blocking that is going ... Under normal conditions I do clean up, however, ...
    (microsoft.public.dotnet.framework)
  • Re: An electrical grease for a light bulb?
    ... clean the contacts of the socket or replace the socket ... probably using the vaseline as a minor conductor. ... You should also be able to get dielectric grease at Radio Shack, though last time I was there I couldn't find any. ...
    (alt.home.repair)
  • Re: Unix machine re-boots at random
    ... I will clean and re-seat the processor tonight and see what happens. ... I'll get the memtest. ... If this is a Slot 1 CPU, there's a good chance the CPU retention ... heatsink & socket while you're at it. ...
    (comp.unix.sco.misc)