5 ms·
Refcounting is usually considered garbage collection - if going to zero means deallocation the refcounted object. But here we (fsvo) merely use the refcount to
by apk17 15y ago
Refcounting 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.