nemo1275 at gmail.com
Fri Aug 26 05:55:00 UTC 2016
I know it's the design choice that WeakSet and WeakMap's key is not
enumurable because it's weak, but I think values in WeakMap is little
WeakSet's values and WeakMap's keys must not be referenced from the map/set
itself. If values from WeakSet can be accessed, then it cannot be GCed. And
it's not we want for WeakMap/Set.
But well, WeakMap's values ARE referenced from WeakMap, via map.get(key).
So values in WeakMap cannot GCed until it's matching key is GCed, and it's
My suggestion is, a new WeakMap method that does same thing as
Map.prototype.values(). With such method, we can utilize JS runtime's GC
functionality in userspace.
For example, I'm planning to make immutable data structures on
SharedArrayBuffer to boost data passing speed between Workers. As you may
know proper GC is the important problem for immutable data structure. But
in this case GC is not the free lunch as data is shared between multiple JS
context. So I need to check manually what data node is still visible in
each context, and clear unused data manually.
Please tell me your idea about this suggestion
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss