Re: Should the Dispose( ) method only run when there are no other references to an object?





"Michael C" <nospam@xxxxxxxxxx> wrote in message news:eSZ5zzdPHHA.4924@xxxxxxxxxxxxxxxxxxxxxxx
"Steve Richter" <StephenRichter@xxxxxxxxx> wrote in message news:1169438284.988182.270380@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
thanks for confirming that. I can accept that I have to program for it.
I am thinking that the absence of reference counting from .NET objects
is a failing of its design.

It's not a failing, the very idea was to get rid of ref counting.

To be fair, ref counting is semantically superior, but it's more expensive than garbage collecting.


Can I define a ReferenceCountObject class
that is derived from Object. Then base any class of mine that I want to
maintain a reference count in from that class? How would such a class
work to update the reference count when the object is passed by
reference to a method or added to a list?

It wouldn't. Reference counting would need to be baked into the low-level memory management of .NET so that all those reference assignments operations correctly maintained the reference count.


David

.



Relevant Pages

  • Re: ANN: Q language website (new)
    ... > Ref counting is usually the worst GC technique. ... it can happen that removing a reference take a long time (eg ... read some good tutorial book covering all the GC techniques ...
    (comp.lang.misc)
  • Re: threading support in python
    ... counting on the refcounting GC semantics that sjdevnull advocates ... If you want "every object stays around forever" ... semantics, you can just not free anything. ... It seemed obvious to me that Paul's reference to making it "look like every object stays around forever" doesn't exclude their being garbage-collected once the program no longer contains any reference to them. ...
    (comp.lang.python)
  • Re: Boolean Buyers Beware ... AIX compiler bug --- PMR 26241,756
    ... In order for a thread to increment a reference ... Seems like your confusing normal thread safety with strong thread safety? ... the code is only broken if your using normal reference counting ... This rule does not apply to atomically thread-safe counting. ...
    (comp.programming.threads)
  • Re: Another term instead of GC
    ... things like RCU, SMR hazard pointers, and possibly reference ... GC only means Boehm style tracing and are clue impervious to ... reference counting, although it may not be appropriate for RCU and ...
    (comp.programming.threads)
  • Re: Lock-free algorithms and reference counting
    ... Its heavily distributed per-thread reference counting. ... Per-thread proxy counting... ... The problem with proxy collectors is their granularity. ...
    (comp.programming.threads)

Loading