Patrick Steele wrote:

> > What I can't understand why reference couting wasn't
> > implemented in CLI as a standard facility. A [Counted]
> > attribute would do the trick nicely.
> > ...
>
> See:
>
>
http://discuss.develop.com/archives/wa.exe?A2=ind0010a&L=dotnet&P=39459

I've seen Brian's argument, and they make sense if you are discussing
reference counting vs. garbage collection. But what I am saying is that
_optional_ reference counting could be implemented _on top_ of garbage
collection for those interfaces,
classes and references that are marked with the (hypotetical) [Counted]
attribute.

That could be used to ensure that Dispose() is called when the last
[Counted] reference is destroyed, as a way to reclaim handles and other
resources. Then later the garbage collector would come and reclaim the
memory.

Dejan

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to