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 -- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html GPC download signing key: ACB3 79B2 7EB2 B7A7 EFDE D101 CD02 4C9D 0FE0 E5E8