jason.orendorff at gmail.com
Sun Nov 4 13:10:17 PST 2012
On Sun, Nov 4, 2012 at 3:58 AM, Claus Reinke <claus.reinke at talk21.com>wrote:
> The set of values actually contained by the WeakMap at any moment is
>> non-deterministic, depending on the scheduling of gc. But this
>> non-determinism is non-observable. WeakMap.contains would make it
> a) this concise elaboration should be part of the spec, to reduce
> guessing about the design intentions
Definitely worth a note.
b) there is at least one use case where observing gc would be
> useful: instrumenting code for heap profiling; [...]
Firefox has a function,
Components.utils.nonDeterministicGetWeakMapKeys(weakmap), that can observe
GC in this way. Only privileged code (the browser itself, addons, and
certain tests) can use it. Web scripts can't.
When implementation details get exposed as part of a platform, programs
start depending (often unintentionally) on them. Let's not expose memory
management implementation details to the Web.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss