4 ms·
I suppose it's just semantics. The fact that you're actually writing the code yourself to do reference counting and releasing of the references is what makes me
by justncase80 15y ago
I suppose it's just semantics. The fact that you're actually writing the code yourself to do reference counting and releasing of the references is what makes me think it's not garbage collection, it's manual. When you drop the reference, then it actually becomes garbage and the javascript GC will free it sometime after that.
- apk17 15y agoRefcounting is usually considered garbage collection - if going to zero means deallocation the refcounted object. But here we (fsvo) merely use the refcount to not drop objects out of the hashmap while they are in use, and a specific algorithm is employed that decides which objects are actually removed (and thus later dropped by the JS GC). This is much like WeakRef/WeakHashMap, with the difference that the decision which objects are dropped is not random/up to the GC implementor. And because of those two thing - dropping things out of the cache isn't random, and it is not triggered by actually running low on memory (is it not?) - I'd not consider this GC. GC tries to keep the illusion of infinite space, and this algo explicitly codes to a specific amount of available space.