3 ms·
> And reference counting also renders the point of determinism moot - now you never know if releasing a reference while trigger freeing a resource. You know th
by letzjuc 13y ago
> And reference counting also renders the point of determinism moot - now you never know if releasing a reference while trigger freeing a resource.
You know that releasing the last reference will. That is why the important concept is single ownership of resources and not reference counting by itself.
- danbruc 13y agoBut you don't know which reference is the last until you actually get there - that is why you used reference counting in the first place, because you were unable to statically determine which reference will be the last one. So every time you abandon a reference it might be the last one and you might have to spend extra cycles to free the resource. This is no more deterministic than a garbage collector.
- letzjuc 13y agoIn a non-deterministic garbage collector memory _might not_ be released when the last reference goes out of scope (and this is often the case).