Are Map with no references and their values with no references GC'd?
# Jordan Harband (7 years ago)
If the Map is collected, all of its keys and values are no longer referenced by it, so if there were no other references to them, they'd be collected at some point.
I have a
WeakMap
whose values areMap
instances. The values of all theMap
s inside theWeakMap
areobject
s. If references to keys of theWeakMap
are lost and therefore those items removed from theWeakMap
, will theMap
s' values be GC'd if there are no references to the Maps or to the Map values.I'm intuitively assuming "yes", but just want to confirm that I don't have to explicitly removed everything from the
Map
s manually first./#!/JoePea