Frank D. Engel, Jr. wrote:
My point here was to use the reference counts to track dangling pointers. Once the number of dangling pointers reaches zero, there aren't any anymore; meanwhile, checking that count before accessing the memory location would provide instant and very efficient confirmation on whether or not the pointer is still valid.
This particular check might be efficient, but the whole system with reference count increments/decrements is not so simple, and you always have to consider the whole system.
Also, ignoring `Dispose' and treating a pointer as valid as long as there are references to it merely transform a crash into a program logic error (still using memory which you claimed, by `Dispose', you wouldn't use anymore). GC or reference counting doesn't magically solve all problems.
Frank