3 ms·
Reference counting is a form of GC. It has nondeterministic delays. You don't know which dropref() operation will just decrement and which will finalize. Moreov
by kazinator 10y ago
Reference counting is a form of GC. It has nondeterministic delays. You don't know which dropref() operation will just decrement and which will finalize. Moreover, when refcounted objects finalize, they recursively drop the refs they hold.
Of course, in some trivial cases it is obvious. But in those cases, you could use manual memory management. For instance, trivial case: making an object and then dropping it in the same scope.
- dllthomas 10y ago> Moreover, when refcounted objects finalize, they recursively drop the refs they hold. You can (at the cost of some additional complication) make this more deterministic by adding newly-dead objects to a "finalize this soon" queue and chewing through that when you have time (or on a different thread).