Removal of WeakMap/WeakSet clear

Allen Wirfs-Brock allen at wirfs-brock.com
Wed Dec 3 11:46:46 PST 2014


On Dec 3, 2014, at 11:28 AM, Chris Toshok wrote:

> A more compact implementation occurred to me during my commute:  just have an internal slot in the WC that it uses when looking up values, instead of the WC reference itself.
> 
> This has the downside of not being able to purge old slots on calls to has/get, but removes the possibility of overflow (if 'generation' is a uint32, e.g)

Presumably one use for a clear operation is to release the association between the key and the value and hence enable GC of the value (if it has no other references).  This approach won't accomplish that.  It provides behaviorally clears the map but doesn't provide the potential GC benefits. 

Allen



More information about the es-discuss mailing list