Feature-Request: allow to iterate over WeakSet / WeakMap

Michael Kriegel michael.kriegel at actifsource.com
Wed Jul 13 14:59:29 UTC 2016



On 13.07.2016 16:27, Boris Zbarsky wrote:
> On 7/13/16 10:18 AM, Michael Kriegel wrote:
>> But shouldn't it be predictable, whether there
>> are still "non-weak" references to an object?
>
> Maybe.  The GC may include a machine stack scanner to root things 
> referenced on the stack, which can give false positives depending on 
> what integers happen to be hanging out on the stack.

So what does gc do to determine, whether an object still has hard 
references pointing towards it?

>
>> does NOT depend on, whether the object has actually been gc'ed, but 
>> whether the object does
>> have "non-weak" references to it.
>
> Determining this basically requires running a full gc, no?

Depends on how the gc works. If "deleting the last reference to an 
object" leads to an immediate deletion of all references to other 
objects held by this object, then: no.

>
>> I am not sure, which kinds of garbage collectors the implementations of
>> ECMAScript typically use. If they used a reference counter
>
> They don't.

Any resources on what they do? E.g. chrome V8 or Firefox?

>
> -Boris
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss




More information about the es-discuss mailing list