Feature-Request: allow to iterate over WeakSet / WeakMap
Allen Wirfs-Brock
allen at wirfs-brock.com
Wed Jul 13 16:12:42 UTC 2016
> On Jul 13, 2016, at 7:18 AM, Michael Kriegel <michael.kriegel at actifsource.com <mailto:michael.kriegel at actifsource.com>> wrote:
>
> I am not sure, which kinds of garbage collectors the implementations of ECMAScript typically use. If they used a reference counter, which counts "non-weak" references only, a simple check, whether the reference count is 0 or not on access to a weak reference would be sufficient.
Reference counting is not “garbage collection” because reference counting can not recover circular chains of object references.
Modern garbage collector are complex heuristic-based beasts that try to make good trade-offs between latency (how long does an object continue to consume storage after it actually becomes unreferenced) and performance (how much of the total processing cycles is consume trying to recover unreferenced objects). Each implementation’s GC uses different heuristics to optimize that trade-off. Thus when any given object would will be observably GC'ed is non-deterministic between implementations (and often even within a particular implementation).
If you want to drill deep into how garbage collectors work, there are lots of good resources at http://www.memorymanagement.org/index.html <http://www.memorymanagement.org/index.html>
Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160713/a4d0ba11/attachment.html>
More information about the es-discuss
mailing list