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.

Re: Reference Count by Willy

Willy
Wed May 11 11:26:07 CDT 2005


"Arthur M." <ArthurM@discussions.microsoft.com> wrote in message
news:28911F0C-D268-4E69-A923-DEFE1FF1F6E1@microsoft.com...
> 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.




Re: Reference Count by ArthurM

ArthurM
Wed May 11 12:02:02 CDT 2005

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.





"Willy Denoyette [MVP]" wrote:

>
> "Arthur M." <ArthurM@discussions.microsoft.com> wrote in message
> news:28911F0C-D268-4E69-A923-DEFE1FF1F6E1@microsoft.com...
> > 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.
>
>
>
>

Re: Reference Count by Lloyd

Lloyd
Wed May 11 18:35:08 CDT 2005

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...

"Arthur M." <ArthurM@discussions.microsoft.com> wrote in message
news:477387AB-2858-4F0E-84DB-076E30BA35AC@microsoft.com...
> 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.
>
>
>
>
>
> "Willy Denoyette [MVP]" wrote:
>
>>
>> "Arthur M." <ArthurM@discussions.microsoft.com> wrote in message
>> news:28911F0C-D268-4E69-A923-DEFE1FF1F6E1@microsoft.com...
>> > 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.
>>
>>
>>
>>