Reference Count

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know of a way to gain access to runtime's reference counters? GC
keeps track of references... how do i gain access to them though.
 
Arthur M. said:
Does anyone know of a way to gain access to runtime's reference counters?
GC
keeps track of references... how do i gain access to them though.

The run time doesn't use reference counters for managed objects, it keeps
track of managed references, and the GC collect those objects that do not
have roots.

Willy.
 
Is there a way to gain access to managed references list then?
What I need to do is to allow an object to know when all reference to it are
gone.

The core of the problem is Async IO & Garbage collection; if a socket or a
network stream initiated Async io call, until it completes Garbage collector
will ignore it. Which makes it very problematic for objects with lost
references.

I.E. If i loose a reference to an object (or object tree) which is utilizing
IOCP, there is no way for me to get the object closed other then kill the
process.
If I were to have access to references to a particular object (socket in my
case) then I would be able to check them periodically, and if refrence is
lost I can initiate a call to socket shutdown.

I suspect any device bound to an operating system handle will experience the
same issue.
 
I don't get you..
why do you lost the reference? what do you mean?

if you want to keep track of this socket and close it eventually, why don't
you create a reference to it?
or if there is heaps of them a colection with some time information?
also socket have a timeout, I believe, and you could change it
programatically...
 
Back
Top