This updates the cache objects to use Weakmap instead of Map in order to prevent potential memory leaks. Maps treat the objects used for keys as a new reference, if the original reference was deleted there would be the reference in the key which would not be garbage collected. Using a Weakmap this reference would be garbage collected when the original reference is removed.
This updates the cache objects to use
Weakmap
instead ofMap
in order to prevent potential memory leaks.Map
s treat the objects used for keys as a new reference, if the original reference was deleted there would be the reference in the key which would not be garbage collected. Using aWeakmap
this reference would be garbage collected when the original reference is removed.